includes/clientside/static/ajax.js
author Dan
Wed, 07 Oct 2009 13:01:00 -0400
changeset 1129 d56a55a3011b
parent 1125 367768040a61
child 1226 de56132c008d
permissions -rw-r--r--
MiniPrompt: [minor] Added short delay before destruction in whiteOutDestroyWithImage().
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
906
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    36
window.ajaxProtect = function(existing_level)
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    37
{
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
    38
  // 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
    39
  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
    40
    return true;
906
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    41
  
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    42
  // touch this variable to allow it to be used in child functions
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    43
  void(existing_level);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    44
  
907
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
    45
  // require re-auth
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
    46
  if ( auth_level <= USER_LEVEL_MEMBER )
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
    47
  {
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
    48
    load_component(['login', 'fadefilter', 'flyin', 'jquery', 'jquery-ui', 'crypto', 'messagebox']);
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
    49
    ajaxDynamicReauth(function(key)
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
    50
      {
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
    51
        ajaxProtect(existing_level);
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
    52
      }, user_level);
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
    53
    
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
    54
    return false;
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
    55
  }
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
    56
  
906
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    57
  load_component(['messagebox', 'jquery', 'jquery-ui', 'l10n', 'fadefilter', 'flyin']);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    58
  
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    59
  // preload language
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    60
  $lang.get('meta_meta');
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    61
  
906
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    62
  var mp = miniPrompt(function(parent)
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    63
    {
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    64
      var icon_full = gen_sprite_html(cdnPath + '/images/protect-icons.png', 22, 22, 0, 0);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    65
      var icon_semi = gen_sprite_html(cdnPath + '/images/protect-icons.png', 22, 22, 22, 0);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    66
      var icon_none = gen_sprite_html(cdnPath + '/images/protect-icons.png', 22, 22, 44, 0);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    67
      
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    68
      $(parent).append('<h3>' + $lang.get('onpage_protect_heading') + '</h3>');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    69
      $(parent).append('<p>' + $lang.get('onpage_protect_msg_select_level') + '</p>');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    70
      
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    71
      $(parent).append('<div class="protectlevel"><label><input type="radio" id="protect_level_1" name="protect_level" /> ' + icon_full + ' ' + $lang.get('onpage_protect_btn_full') + '</label></div>');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    72
      $(parent).append('<div class="protectlevel_hint" id="protect_level_1_hint">' + $lang.get('onpage_protect_btn_full_hint') + '</div>');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    73
      $(parent).append('<div class="protectlevel"><label><input type="radio" id="protect_level_2" name="protect_level" /> ' + icon_semi + ' ' + $lang.get('onpage_protect_btn_semi') + '</label></div>');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    74
      $(parent).append('<div class="protectlevel_hint" id="protect_level_2_hint">' + $lang.get('onpage_protect_btn_semi_hint') + '</div>');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    75
      $(parent).append('<div class="protectlevel"><label><input type="radio" id="protect_level_0" name="protect_level" /> ' + icon_none + ' ' + $lang.get('onpage_protect_btn_none') + '</label></div>');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    76
      $(parent).append('<div class="protectlevel_hint" id="protect_level_0_hint">' + $lang.get('onpage_protect_btn_none_hint') + '</div>');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    77
      
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    78
      $(parent).append('<table class="protectreason"><tr><td valign="top">' + $lang.get('onpage_protect_lbl_reason') + '</td><td><input id="protect_reason" size="30" type="text" /><br /><small>' + $lang.get('onpage_protect_lbl_reason_hint') + '</small></td></tr></table>');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    79
      
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    80
      $(parent).append('<p class="buttons"><a class="submitbutton abutton abutton_green" style="font-weight: bold;" href="#" onclick="ajaxProtectSubmit(this); return false;">' + $lang.get('onpage_protect_btn_submit') + '</a> <a class="submitbutton abutton" href="#" onclick="miniPromptDestroy(this); return false;">' + $lang.get('etc_cancel') + '</a></p>');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    81
      
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    82
      $('.protectlevel', parent).css('line-height', '22px');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    83
      $('h3', parent).css('text-align', 'center');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    84
      $('.protectlevel_hint', parent)
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    85
        .css('font-size', 'smaller')
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    86
        .css('margin-left', '52px')
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    87
        .hide();
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    88
      $('p.buttons', parent).css('margin-top', '15px').css('text-align', 'center');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    89
      
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    90
      if ( typeof(existing_level) == 'number' )
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    91
      {
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    92
        $('#protect_level_' + existing_level, parent).attr('checked', 'checked');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    93
        $('#protect_level_' + existing_level + '_hint', parent).show();
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    94
        $('#protect_level_' + existing_level, parent).parent().append(' <small><span style="color: #050; background-color: #eee; padding: 0 4px;">' + $lang.get('onpage_protect_lbl_current') + '</span></small>');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    95
      }
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    96
      
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    97
      $('input:radio', parent).click(function()
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    98
        {
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
    99
          var mp = miniPromptGetParent(this);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   100
          $('.protectlevel_hint:visible', mp).hide('blind', 150);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   101
          $('#' + this.id + '_hint').show('blind', 150);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   102
          $('#protect_reason').focus();
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   103
        });
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   104
      $('input:text', parent).keyup(function(e)
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   105
        {
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   106
          if ( e.keyCode == 13 )
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   107
            ajaxProtectSubmit(this);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   108
        });
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   109
    });
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   110
}
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   111
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   112
window.ajaxProtectSubmit = function(el)
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   113
{
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   114
  var mp = miniPromptGetParent(el);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   115
  
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   116
  var reason = trim($('#protect_reason', mp).attr('value'));
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   117
  if ( reason == '' )
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   118
  {
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   119
    var oldbg = $('#protect_reason').css('background-color');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   120
    if ( jQuery.fx.off )
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   121
    {
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   122
      $('#protect_reason').css('background-color', '#a00');
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   123
      setTimeout(function()
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   124
        {
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   125
          $('#protect_reason').css('background-color', oldbg);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   126
        }, 1000);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   127
    }
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   128
    else
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   129
    {
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   130
      $('#protect_reason').css('background-color', '#a00').animate({ backgroundColor: oldbg }, 1000);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   131
    }
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   132
    return false;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   133
  }
906
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   134
  
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   135
  var level = 0;
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   136
  if ( $('#protect_level_1', mp).attr('checked') )
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   137
    level = 1;
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   138
  if ( $('#protect_level_2', mp).attr('checked') )
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   139
    level = 2;
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   140
  
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   141
  var whitey = whiteOutMiniPrompt(mp);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   142
  $.post(stdAjaxPrefix + '&_mode=protect', { level: level, reason: reason }, function(response, statustext)
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   143
    {
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   144
      if ( response.success )
481
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   145
      {
906
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   146
        whiteOutReportSuccess(whitey);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   147
        // update protect button
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   148
        var btn = $('#tb_ajax_protect_btn').get(0);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   149
        btn.level = level;
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   150
        btn.setAttribute('onclick', null);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   151
        btn.onclick = null;
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   152
        $(btn).click(function()
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   153
          {
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   154
            ajaxProtect(this.level);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   155
            return false;
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   156
          });
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   157
        var status = '';
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   158
        switch(level)
481
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   159
        {
906
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   160
          case 1: status = $lang.get('onpage_btn_protect_on'); break;
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   161
          case 0: status = $lang.get('onpage_btn_protect_off'); break;
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   162
          case 2: status = $lang.get('onpage_btn_protect_semi'); break;
481
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   163
        }
906
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   164
        $('#tb_ajax_protect_status').text(status);
481
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   165
      }
906
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   166
      else
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   167
      {
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   168
        whiteOutReportFailure(whitey);
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   169
        alert($lang.get('page_err_' + response.error));
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   170
      }
c949e82b8f49 New page protection UI. Both miniPrompt and failsafe HTML.
Dan
parents: 903
diff changeset
   171
    }, 'json');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   172
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   173
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   174
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
   175
{
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
   176
  // 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
   177
  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
   178
    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
   179
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   180
  // 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
   181
  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
   182
  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
   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
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 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
   186
{
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
  // 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
   188
  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
   189
  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
   190
  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
   191
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   192
  // 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
   193
  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
   194
  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
   195
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   196
  // 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
   197
  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
   198
  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
   199
  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
   200
  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
   201
  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
   202
  
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
  // 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
   204
  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
   205
  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
   206
  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
   207
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   208
  // 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
   209
  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
   210
  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
   211
  
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
  // 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
   213
  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
   214
  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
   215
  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
   216
  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
   217
  
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
   218
  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
   219
  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
   220
  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
   221
  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
   222
  
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
   223
  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
   224
  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
   225
  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
   226
  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
   227
  
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
   228
  // 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
   229
  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
   230
  {
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
   231
    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
   232
    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
   233
  }
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
   234
  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
   235
  {
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
   236
    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
   237
    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
   238
  }
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
   239
  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
   240
  {
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
   241
    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
   242
    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
   243
  }
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
   244
  
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
   245
  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
   246
    {
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
   247
      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
   248
    }, ( 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
   249
}
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
   250
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   251
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
   252
{
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
   253
  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
   254
  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
   255
    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
   256
  
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   257
  var input = box.getElementsByTagName('input')[0];
592
27377179fe58 Another sweep from the optimization monster.
Dan
parents: 585
diff changeset
   258
  if ( !input )
27377179fe58 Another sweep from the optimization monster.
Dan
parents: 585
diff changeset
   259
    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
   260
    
592
27377179fe58 Another sweep from the optimization monster.
Dan
parents: 585
diff changeset
   261
  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
   262
  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
   263
  
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
   264
  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
   265
  {
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
   266
    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
   267
    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
   268
  }
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
   269
  
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
   270
  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
   271
  {
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
   272
    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
   273
  }
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
   274
  
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
   275
  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
   276
  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
   277
  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
   278
  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
   279
  
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
   280
  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
   281
    {
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
   282
      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
   283
      {
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
   284
        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
   285
        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
   286
        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
   287
        {
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
   288
          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
   289
          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
   290
        }
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
   291
        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
   292
        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
   293
        {
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
   294
          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
   295
          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
   296
          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
   297
          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
   298
        }
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
   299
        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
   300
        {
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
   301
          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
   302
          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
   303
        }
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
   304
      }
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
   305
    }, 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
   306
}
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
   307
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   308
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
   309
{
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
   310
  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
   311
  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
   312
  {
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
   313
    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
   314
  }
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
   315
  document.title = newname;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   316
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   317
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   318
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
   319
{
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
   320
  // 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
   321
  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
   322
    return true;
907
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   323
  
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   324
  // require re-auth
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   325
  if ( auth_level <= USER_LEVEL_MEMBER )
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   326
  {
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   327
    load_component(['login', 'fadefilter', 'flyin', 'jquery', 'jquery-ui', 'crypto', 'messagebox']);
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   328
    ajaxDynamicReauth(function(key)
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   329
      {
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   330
        ajaxDeletePage();
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   331
      }, user_level);
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   332
    
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   333
    return false;
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   334
  }
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   335
  
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
   336
  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
   337
  
bd5069e1f19a 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
  // 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
   339
  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
   340
    {
bd5069e1f19a 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
      // 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
   342
      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
   343
      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
   344
      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
   345
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   346
      // "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
   347
      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
   348
      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
   349
      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
   350
      
bd5069e1f19a 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
      // 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
   352
      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
   353
      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
   354
      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
   355
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   356
      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
   357
      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
   358
      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
   359
      {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   360
        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
   361
        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
   362
        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
   363
        {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   364
          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
   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
            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
   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
        }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   369
        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
   370
        {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   371
          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
   372
        }
bd5069e1f19a 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
      
bd5069e1f19a 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
      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
   376
      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
   377
      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
   378
      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
   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
      // 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
   381
      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
   382
      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
   383
      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
   384
      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
   385
      
bd5069e1f19a 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
      // 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
   387
      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
   388
      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
   389
      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
   390
      
bd5069e1f19a 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
      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
   392
      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
   393
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   394
      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
   395
      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
   396
      
bd5069e1f19a 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
      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
   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
      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
   400
      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
   401
      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
   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
      // 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
   404
      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
   405
      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
   406
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   407
      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
   408
      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
   409
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   410
      // 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
   411
      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
   412
      {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   413
        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
   414
        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
   415
        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
   416
          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
   417
      }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   418
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   419
      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
   420
      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
   421
      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
   422
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   423
      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
   424
      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
   425
      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
   426
      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
   427
      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
   428
      {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   429
        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
   430
        {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   431
          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
   432
        }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   433
        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
   434
      }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   435
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   436
      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
   437
      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
   438
      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
   439
      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
   440
      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
   441
      {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   442
        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
   443
        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
   444
      }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   445
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   446
      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
   447
      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
   448
      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
   449
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   450
      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
   451
      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
   452
        {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   453
          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
   454
        }, 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
   455
    });
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   456
}
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   457
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   458
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
   459
{
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   460
  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
   461
  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
   462
  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
   463
  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
   464
  
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   465
  if ( trim(reason.value) == '' )
28
dd2edcdc6c03 Deleting pages now requires a reason
Dan
parents: 15
diff changeset
   466
  {
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
   467
    // 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
   468
    $(reason.parentNode).effect("highlight", {}, 1000);
28
dd2edcdc6c03 Deleting pages now requires a reason
Dan
parents: 15
diff changeset
   469
    return false;
dd2edcdc6c03 Deleting pages now requires a reason
Dan
parents: 15
diff changeset
   470
  }
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
   471
  
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   472
  if ( !confirm.checked )
28
dd2edcdc6c03 Deleting pages now requires a reason
Dan
parents: 15
diff changeset
   473
  {
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
   474
    // 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
   475
    $(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
   476
    return false;
28
dd2edcdc6c03 Deleting pages now requires a reason
Dan
parents: 15
diff changeset
   477
  }
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
   478
  
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   479
  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
   480
  
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   481
  // 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
   482
  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
   483
  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
   484
    {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   485
      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
   486
      {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   487
        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
   488
        
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   489
        // 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
   490
        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
   491
        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
   492
        
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   493
        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
   494
        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
   495
        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
   496
        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
   497
        
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   498
        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
   499
        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
   500
        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
   501
        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
   502
        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
   503
        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
   504
        {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   505
          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
   506
          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
   507
          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
   508
        }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   509
        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
   510
        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
   511
        
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   512
        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
   513
      }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   514
    });
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   515
  
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   516
  return true;
1
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
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   519
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
   520
{
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
   521
  load_component(['l10n', 'messagebox', 'flyin', 'fadefilter']);
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   522
  
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
   523
  // 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
   524
  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
   525
    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
   526
  miniPromptMessage({
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   527
      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
   528
      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
   529
      buttons: [
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   530
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   531
          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
   532
          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
   533
          style: {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   534
            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
   535
          },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   536
          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
   537
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   538
            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
   539
            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
   540
            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
   541
              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
   542
                unsetAjaxLoading();
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   543
                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
   544
              }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   545
            }, true);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   546
          }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   547
        },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   548
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   549
          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
   550
          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
   551
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   552
            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
   553
          }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   554
        }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   555
      ]
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   556
    });
1
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.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
   560
{
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
   561
  load_component(['l10n', 'messagebox', 'flyin', 'fadefilter']);
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   562
  
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
   563
  // 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
   564
  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
   565
    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
   566
  miniPromptMessage({
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   567
      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
   568
      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
   569
      buttons: [
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   570
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   571
          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
   572
          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
   573
          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
   574
            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
   575
          },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   576
          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
   577
          {
946
ff58e1732482 AJAX: Reset votes: now uses whiteOutMiniPrompt()
Dan
parents: 907
diff changeset
   578
            var box = miniPromptGetParent(this);
ff58e1732482 AJAX: Reset votes: now uses whiteOutMiniPrompt()
Dan
parents: 907
diff changeset
   579
            var whitey = whiteOutMiniPrompt(box);
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
   580
            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
   581
              if ( ajax.readyState == 4 && ajax.status == 200 ) {
946
ff58e1732482 AJAX: Reset votes: now uses whiteOutMiniPrompt()
Dan
parents: 907
diff changeset
   582
                whiteOutReportSuccess(whitey);
ff58e1732482 AJAX: Reset votes: now uses whiteOutMiniPrompt()
Dan
parents: 907
diff changeset
   583
                
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   584
                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
   585
                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
   586
                {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   587
                  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
   588
                  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
   589
                }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   590
              }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   591
            }, true);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   592
          }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   593
        },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   594
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   595
          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
   596
          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
   597
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   598
            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
   599
          }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   600
        }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   601
      ]
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   602
    });
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   603
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   604
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   605
// Editing/saving category information
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   606
// 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
   607
// find someone to work on just the Javascript part of Enano...
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   608
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   609
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
   610
{
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
  // 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
   612
  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
   613
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   614
  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
   615
  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
   616
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   617
      unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   618
      edit_open = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   619
      eval(ajax.responseText);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   620
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   621
  });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   622
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   623
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   624
window.ajaxCatSave = function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   625
{
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
   626
  // 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
   627
  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
   628
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   629
  if(!catlist)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   630
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   631
    alert('Var catlist has no properties');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   632
    return;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   633
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   634
  query='';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   635
  for(i=0;i<catlist.length;i++)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   636
  {
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   637
    var s = ( document.forms.mdgCatForm['mdgCat_' + catlist[i]]['checked'] ) ? true : false;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   638
    if(s) query = query + '&' + catlist[i] + '=true';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   639
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   640
  setAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   641
  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
   642
  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
   643
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   644
      unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   645
      edit_open = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   646
      if(ajax.responseText != 'GOOD') alert(ajax.responseText);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   647
      ajaxReset();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   648
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   649
  });
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
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   652
// History stuff
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   653
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   654
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
   655
{
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
   656
  // 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
   657
  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
   658
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   659
  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
   660
  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
   661
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   662
      unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   663
      edit_open = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   664
      selectButtonMajor('article');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   665
      selectButtonMinor('history');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   666
      document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   667
      buildDiffList();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   668
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   669
  });
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
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   672
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
   673
  // 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
   674
  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
   675
    return true;
481
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   676
  if(!ttl) ttl=title;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   677
  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
   678
  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
   679
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   680
      unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   681
      edit_open = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   682
      document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   683
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   684
  });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   685
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   686
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   687
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
   688
  // 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
   689
  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
   690
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   691
  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
   692
  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
   693
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   694
      unsetAjaxLoading();
481
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   695
      
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   696
      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
   697
      if ( !check_json_response(response) )
481
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   698
      {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   699
        handle_invalid_json(response);
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   700
        return false;
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   701
      }
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   702
      
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   703
      response = parseJSON(response);
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   704
      if ( response.success )
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   705
      {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   706
        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
   707
      }
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   708
      else
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   709
      {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   710
        if ( response.action )
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   711
        {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   712
          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
   713
        }
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   714
        else
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   715
        {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   716
          alert( $lang.get('page_err_' + response.error) );
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   717
        }
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   718
      }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   719
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   720
  });
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
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   723
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
   724
{
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
   725
  // 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
   726
  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
   727
    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
   728
  
907
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   729
  // require re-auth
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   730
  if ( auth_level <= USER_LEVEL_MEMBER )
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   731
  {
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   732
    load_component(['login', 'fadefilter', 'flyin', 'jquery', 'jquery-ui', 'crypto', 'messagebox']);
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   733
    ajaxDynamicReauth(function(key)
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   734
      {
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   735
        ajaxClearLogs();
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   736
      }, user_level);
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   737
    
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   738
    return false;
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   739
  }
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 906
diff changeset
   740
  
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
   741
  load_component(['l10n', 'messagebox', 'flyin', 'fadefilter']);
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   742
  
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   743
  miniPromptMessage({
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   744
      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
   745
      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
   746
      buttons: [
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   747
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   748
          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
   749
          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
   750
          style: {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   751
            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
   752
          },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   753
          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
   754
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   755
            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
   756
            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
   757
            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
   758
              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
   759
                unsetAjaxLoading();
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   760
                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
   761
                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
   762
              }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   763
            });
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   764
          }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   765
        },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   766
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   767
          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
   768
          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
   769
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   770
            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
   771
          }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   772
        }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   773
      ]
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   774
    });
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   775
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   776
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   777
window.buildDiffList = function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   778
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   779
  arrDiff1Buttons = getElementsByClassName(document, 'input', 'clsDiff1Radio');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   780
  arrDiff2Buttons = getElementsByClassName(document, 'input', 'clsDiff2Radio');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   781
  var len = arrDiff1Buttons.length;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   782
  if ( len < 1 )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   783
    return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   784
  timelist = new Array();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   785
  for ( var i = 0; i < len; i++ )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   786
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   787
    timelist.push( arrDiff2Buttons[i].id.substr(6) );
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   788
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   789
  timelist.push( arrDiff1Buttons[len-1].id.substr(6) );
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   790
  delete(timelist.toJSONString);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   791
  for ( var i = 1; i < timelist.length-1; i++ )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   792
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   793
    if ( i >= timelist.length ) break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   794
    arrDiff2Buttons[i].style.display = 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   795
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   796
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   797
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   798
window.selectDiff1Button = function(obj)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   799
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   800
  var this_time = obj.id.substr(6);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   801
  var index = parseInt(in_array(this_time, timelist));
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   802
  for ( var i = 0; i < timelist.length - 1; i++ )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   803
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   804
    if ( i < timelist.length - 1 )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   805
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   806
      var state = ( i < index ) ? 'inline' : 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   807
      var id = 'diff2_' + timelist[i];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   808
      document.getElementById(id).style.display = state;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   809
      
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   810
      // alert("Debug:\nIndex: "+index+"\nState: "+state+"\ni: "+i);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   811
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   812
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   813
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   814
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   815
window.selectDiff2Button = function(obj)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   816
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   817
  var this_time = obj.id.substr(6);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   818
  var index = parseInt(in_array(this_time, timelist));
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   819
  for ( var i = 1; i < timelist.length; i++ )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   820
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   821
    if ( i < timelist.length - 1 )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   822
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   823
      var state = ( i > index ) ? 'inline' : 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   824
      var id = 'diff1_' + timelist[i];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   825
      document.getElementById(id).style.display = state;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   826
      
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   827
      // alert("Debug:\nIndex: "+index+"\nState: "+state+"\ni: "+i);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   828
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   829
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   830
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   831
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   832
window.ajaxHistDiff = function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   833
{
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
   834
  // 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
   835
  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
   836
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   837
  var id1=false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   838
  var id2=false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   839
  for ( i = 0; i < arrDiff1Buttons.length; i++ )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   840
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   841
    k = i + '';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   842
    kpp = i + 1;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   843
    kpp = kpp + '';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   844
    if(arrDiff1Buttons[k].checked) id1 = arrDiff1Buttons[k].id.substr(6);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   845
    if(arrDiff2Buttons[k].checked) id2 = arrDiff2Buttons[k].id.substr(6);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   846
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   847
  if(!id1 || !id2) { alert('BUG: Couldn\'t get checked radiobutton state'); return; }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   848
  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
   849
  ajaxGet(stdAjaxPrefix+'&_mode=pagediff&diff1='+id1+'&diff2='+id2, function(ajax)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   850
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   851
      if ( ajax.readyState == 4 && ajax.status == 200 )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   852
      {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   853
        unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   854
        document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   855
      }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   856
    });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   857
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   858
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   859
// Change the user's preferred style/theme
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   860
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   861
window.ajaxChangeStyle = function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   862
{
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
   863
  // 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
   864
  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
   865
    return true;
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   866
  load_component(['l10n', 'fadefilter', 'jquery', 'jquery-ui']);
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   867
  
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   868
  // force string fetch
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   869
  $lang.get('etc_cancel');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   870
  
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   871
  // preload some images
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   872
  var i1 = new Image();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   873
  i1.src = cdnPath + '/images/loading-big.gif';
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   874
  var i2 = new Image();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   875
  i2.src = cdnPath + '/images/check-large.png';
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   876
  
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   877
  darken(true, 70, 'theme-selector-shade');
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
  $('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
   880
  $('#theme-selector-wrapper')
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   881
    .css('top', String(getScrollOffset()) + 'px')
881
01810d32a0d6 AJAX: theme selector: explicitly set wrapper div to 0 to prevent sidescrolling
Dan
parents: 870
diff changeset
   882
    .css('left', 0)
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   883
    .css('z-index', String( getHighestZ() + 20 ));
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   884
  
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   885
  $.get(stdAjaxPrefix + '&_mode=theme_list', {}, function(data, status)
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   886
    {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   887
      $('#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
   888
      $('#theme-selector-body').animate({ width: 728 }, 600, function()
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   889
        {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   890
          // 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
   891
          if ( !aclDisableTransitionFX )
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   892
            changeOpac(0, 'theme-selector-inner');
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   893
          $('#theme-selector-inner').html('<h3></h3>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   894
          $('#theme-selector-inner > h3').text($lang.get('ajax_thmsel_lbl_choosetheme'));
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   895
          $('#theme-selector-inner').append('<ul></ul>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   896
          for ( var i = 0; i < data.length; i++ )
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   897
          {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   898
            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
   899
            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
   900
            $('#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
   901
              .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
   902
              .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
   903
              .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
   904
              .append('<li id="theme_' + i + '"><a href="#"><span></span></a></li>');
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   905
            $('#theme-selector-inner li#theme_' + i + ' > a')
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   906
              .css('background-image', 'url(' + bgi + ')')
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   907
              .attr('enano:theme_id', data[i].theme_id);
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   908
            $('#theme-selector-inner li#theme_' + i + ' > a > span')
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   909
              .text(data[i].theme_name);
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   910
          }
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   911
          $('#theme-selector-inner').append('<span class="menuclear"></span>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   912
          $('#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
   913
          
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   914
          $('#theme-selector-body').animate({ height: $('#theme-selector-inner').height() + 30 }, 600, function()
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   915
            {
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   916
              if ( !aclDisableTransitionFX )
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   917
                opacity('theme-selector-inner', 0, 100, 750);
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   918
            });
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   919
          
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   920
          $('#theme-selector-inner li a').click(function()
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   921
            {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   922
              var theme_id = $(this).attr('enano:theme_id');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   923
              $('span', this).html('&nbsp;').addClass('loading').fadeTo('fast', 0.6)
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   924
              $.get(stdAjaxPrefix + '&_mode=get_styles', { theme_id: theme_id }, function(data, status)
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   925
                {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   926
                  if ( data.length > 1 )
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   927
                  {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   928
                    $('#theme-selector-inner').css('height', $('#theme-selector-inner').height()).fadeOut(600, function()
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   929
                    {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   930
                      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
   931
                      if ( !aclDisableTransitionFX )
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   932
                        domObjChangeOpac(0, div);
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   933
                      
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   934
                      $(div).attr('id', 'theme-selector-style-list').append('<h3></h3>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   935
                      $('h3', div).text($lang.get('ajax_thmsel_lbl_choosestyle'));
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   936
                      
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   937
                      for ( var i = 0; i < data.length; i++ )
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   938
                      {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   939
                        $(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
   940
                      }
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   941
                      
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   942
                      $(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
   943
                      
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   944
                      if ( !aclDisableTransitionFX )
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   945
                        changeOpac(0, 'theme-selector-style-list');
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   946
                      $(this).html(div).show();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   947
                      
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   948
                      $('#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
   949
                        {
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   950
                          if ( !aclDisableTransitionFX )
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   951
                            opacity('theme-selector-style-list', 0, 100, 500);
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   952
                        });
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   953
                      
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   954
                      $('.stylebtn').click(function()
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   955
                        {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   956
                          ajaxChangeThemeSetLoading();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   957
                          $.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
   958
                            {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   959
                              if ( data.error )
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   960
                              {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   961
                                alert(data.error);
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   962
                                ajaxChangeStyleClose();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   963
                                return false;
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   964
                              }
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   965
                              ajaxChangeThemeShowSuccess();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   966
                            }, 2000);
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   967
                          
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   968
                          return false;
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   969
                        });
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   970
                    });
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   971
                  }
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   972
                  else
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   973
                  {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   974
                    if ( !data[0] )
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   975
                    {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   976
                      alert('Didn\'t find any CSS files. :-/');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   977
                      ajaxChangeStyleClose();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   978
                    }
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   979
                    
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   980
                    $.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
   981
                      {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   982
                        if ( data.error )
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   983
                        {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   984
                          alert(data.error);
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   985
                          ajaxChangeStyleClose();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   986
                          return false;
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   987
                        }
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   988
                        ajaxChangeThemeShowSuccess();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   989
                      }, 'json');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   990
                  }
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   991
                }, 'json');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   992
              return false;
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   993
            }); // click function
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   994
        }); // animate
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   995
    }, '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
   996
}
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   997
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   998
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
   999
{
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1000
  $('#theme-selector-body').animate({width: 130, height: 130});
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1001
  $('#theme-selector-inner').empty().html('<div class="theme-selector-spinner"></div>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1002
}
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1003
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1004
window.ajaxChangeThemeShowSuccess = function()
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1005
{
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
  1006
  if ( aclDisableTransitionFX )
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
  1007
  {
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
  1008
    $('#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
  1009
  }
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
  1010
  else
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
  1011
  {
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
  1012
    setTimeout(function()
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
  1013
      {
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
  1014
        $('#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
  1015
      }, 10);
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
  1016
  }
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
  1017
  
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1018
  $('#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
  1019
      {
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1020
        $('#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
  1021
        $('#theme-selector-inner').append('<h3>' + $lang.get('ajax_thmsel_msg_success') + '</h3>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1022
        $('#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
  1023
        $('#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
  1024
        $('#theme-selector-inner').fadeIn();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1025
      });
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
  1026
}
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
  1027
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1028
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
  1029
{
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1030
  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
  1031
    {
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1032
      enlighten(false, 'theme-selector-shade');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1033
      $('#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
  1034
        {
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1035
          $(this).remove();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1036
        });
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
  1037
    }, ( 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
  1038
  if ( !aclDisableTransitionFX )
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
  1039
    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
  1040
}
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
  1041
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1042
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
  1043
{
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1044
  if ( typeof(id) != 'string' )
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1045
    return false;
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1046
  id = id.substr(0, 1).toUpperCase() + id.substr(1);
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1047
  id = id.replace(/_/g, ' ');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1048
  id = id.replace(/-/g, ' ');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
  1049
  return id;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1050
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1051
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1052
window.ajaxSetPassword = function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1053
{
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
  1054
  // 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
  1055
  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
  1056
    return true;
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1057
  load_component('crypto');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1058
  pass = hex_sha1(document.getElementById('mdgPassSetField').value);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1059
  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
  1060
  ajaxPost(stdAjaxPrefix+'&_mode=setpass', 'password='+pass, function(ajax)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1061
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1062
      unsetAjaxLoading();
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
  1063
      if ( ajax.readyState == 4 && ajax.status == 200 )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1064
      {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1065
        alert(ajax.responseText);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1066
      }
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
  1067
    }, true);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1068
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1069
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1070
window.ajaxDisableEmbeddedPHP = function()
11
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1071
{
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
  1072
  // 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
  1073
  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
  1074
    return true;
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1075
  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
  1076
    return false;
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1077
  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
  1078
  if ( !$killdiv.object )
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1079
  {
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1080
    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
  1081
    return false;
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1082
  }
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1083
  $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
  1084
  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
  1085
  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
  1086
      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
  1087
      {
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1088
        if ( ajax.responseText == '1' )
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1089
        {
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1090
          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
  1091
          //$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
  1092
          $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
  1093
          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
  1094
          // 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
  1095
          newdiv.className = $killdiv.object.className;
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1096
          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
  1097
          $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
  1098
          $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
  1099
        }
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1100
        else
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1101
        {
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1102
          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
  1103
          $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
  1104
        }
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1105
      }
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1106
    });
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1107
}
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
  1108
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1109
var catHTMLBuf = false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1110
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1111
window.ajaxCatToTag = function()
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1112
{
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1113
  if ( KILL_SWITCH )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1114
    return false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1115
  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
  1116
  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
  1117
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
  1118
      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
  1119
      {
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1120
        unsetAjaxLoading();
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1121
        var resptext = String(ajax.responseText + ' ');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1122
        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
  1123
        if ( resptext.substr(0, 1) != '{' )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1124
        {
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
  1125
          handle_invalid_json(resptext);
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1126
          return false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1127
        }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1128
        var json = parseJSON(resptext);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1129
        var catbox = document.getElementById('mdgCatBox');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1130
        if ( !catbox )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1131
          return false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1132
        var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling;
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1133
        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
  1134
        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
  1135
        catHTMLBuf = catbox.innerHTML;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1136
        catbox.innerHTML = '';
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1137
        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
  1138
        if ( json.tags.length < 1 )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1139
        {
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1140
          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
  1141
        }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1142
        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
  1143
        {
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1144
          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
  1145
          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
  1146
          {
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1147
            catbox.appendChild(document.createTextNode(' '));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1148
            var a = document.createElement('a');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1149
            a.appendChild(document.createTextNode('[X]'));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1150
            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
  1151
            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
  1152
            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
  1153
            catbox.appendChild(a);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1154
          }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1155
          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
  1156
            catbox.appendChild(document.createTextNode(', '));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1157
        }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1158
        if ( json.can_add )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1159
        {
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1160
          catbox.appendChild(document.createTextNode(' '));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1161
          var addlink = document.createElement('a');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1162
          addlink.href = '#';
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1163
          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
  1164
          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
  1165
          catbox.appendChild(addlink);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1166
        }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1167
      }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1168
    });
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1169
}
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1170
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
  1171
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
  1172
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1173
window.ajaxAddTagStage1 = function()
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1174
{
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
  1175
  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
  1176
    return false;
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1177
  var catbox = document.getElementById('mdgCatBox');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1178
  var adddiv = document.createElement('div');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1179
  var text = document.createElement('input');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1180
  var addlink = document.createElement('a');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1181
  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
  1182
  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
  1183
  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
  1184
  text.type = 'text';
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1185
  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
  1186
  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
  1187
  {
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
  1188
    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
  1189
    {
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
  1190
      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
  1191
    }
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
  1192
  }
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1193
  
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1194
  adddiv.style.margin = '5px 0 0 0';
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1195
  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
  1196
  adddiv.appendChild(text);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1197
  adddiv.appendChild(document.createTextNode(' '));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1198
  adddiv.appendChild(addlink);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1199
  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
  1200
  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
  1201
}
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
  1202
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
  1203
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
  1204
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1205
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
  1206
{
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
  1207
  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
  1208
    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
  1209
  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
  1210
    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
  1211
  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
  1212
  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
  1213
  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
  1214
  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
  1215
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
  1216
      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
  1217
      {
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
  1218
        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
  1219
        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
  1220
        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
  1221
        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
  1222
        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
  1223
        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
  1224
        {
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
  1225
          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
  1226
          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
  1227
        }
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
  1228
        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
  1229
        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
  1230
        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
  1231
        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
  1232
        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
  1233
        {
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
  1234
          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
  1235
          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
  1236
          var nukeafter = false;
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1237
          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
  1238
          {
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
  1239
            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
  1240
          }
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
  1241
          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
  1242
          // 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
  1243
          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
  1244
          {
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
  1245
            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
  1246
            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
  1247
            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
  1248
            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
  1249
            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
  1250
            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
  1251
            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
  1252
          }
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
  1253
          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
  1254
          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
  1255
          {
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
  1256
            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
  1257
          }
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
  1258
          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
  1259
          {
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
  1260
            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
  1261
          }
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
  1262
        }
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
  1263
        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
  1264
        {
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
  1265
          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
  1266
        }
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
  1267
      }
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
  1268
    });
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
  1269
}
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
  1270
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1271
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
  1272
{
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
  1273
  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
  1274
  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
  1275
  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
  1276
  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
  1277
    arrDelete.push(parentobj.previousSibling.previousSibling.previousSibling);
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1278
  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
  1279
    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
  1280
  
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1281
  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
  1282
       parentobj.nextSibling.nextSibling.firstChild )
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1283
    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
  1284
      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
  1285
    
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
  1286
  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
  1287
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
  1288
      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
  1289
      {
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
  1290
        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
  1291
        {
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
  1292
          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
  1293
          {
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
  1294
            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
  1295
            {
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
  1296
              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
  1297
            } 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
  1298
          }
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
  1299
          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
  1300
          {
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1301
            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
  1302
            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
  1303
            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
  1304
            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
  1305
          }
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
  1306
        }
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
  1307
        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
  1308
        {
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
  1309
          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
  1310
        }
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
  1311
      }
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
  1312
    });
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1313
}
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1314
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1315
window.ajaxTagToCat = function()
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1316
{
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1317
  if ( !catHTMLBuf )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1318
    return false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1319
  var catbox = document.getElementById('mdgCatBox');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1320
  if ( !catbox )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1321
    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
  1322
  addtag_open = false;
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1323
  var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling;
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1324
  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
  1325
  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
  1326
  catbox.innerHTML = catHTMLBuf;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1327
  catHTMLBuf = false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1328
}
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1329
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
  1330
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
  1331
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1332
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
  1333
{
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
  1334
  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
  1335
    {
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
  1336
    });
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
  1337
}
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
  1338
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1339
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
  1340
{
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
  1341
  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
  1342
  {
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
  1343
    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
  1344
    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
  1345
      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
  1346
    var span = document.getElementById('keepalivestat');
211
753dabeca1ee Completely localized admin tree menu and page toolbar
Dan
parents: 209
diff changeset
  1347
    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
  1348
  }
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
  1349
  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
  1350
  {
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
  1351
    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
  1352
    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
  1353
      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
  1354
    var span = document.getElementById('keepalivestat');
211
753dabeca1ee Completely localized admin tree menu and page toolbar
Dan
parents: 209
diff changeset
  1355
    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
  1356
    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
  1357
  }
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
  1358
}
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
  1359
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
  1360
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
  1361
{
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
  1362
  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
  1363
  {
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
  1364
    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
  1365
      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
  1366
    var span = document.getElementById('keepalivestat');
211
753dabeca1ee Completely localized admin tree menu and page toolbar
Dan
parents: 209
diff changeset
  1367
    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
  1368
  }
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
  1369
  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
  1370
  {
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
  1371
    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
  1372
      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
  1373
    var span = document.getElementById('keepalivestat');
211
753dabeca1ee Completely localized admin tree menu and page toolbar
Dan
parents: 209
diff changeset
  1374
    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
  1375
  }
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
  1376
};
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
  1377
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1378
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
  1379
{
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
  1380
  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
  1381
  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
  1382
}
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
  1383
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1384
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
  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
  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
  1387
  {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1388
    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
  1389
  }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1390
  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
  1391
  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
  1392
  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
  1393
  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
  1394
  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
  1395
  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
  1396
  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
  1397
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
  1398
      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
  1399
      {
0437a7cf1acc Added 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
        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
  1401
        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
  1402
        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
  1403
        {
0437a7cf1acc Added 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
          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
  1405
          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
  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
        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
  1408
        {
0437a7cf1acc Added 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
          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
  1410
          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
  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
            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
  1413
            {
0437a7cf1acc Added 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
              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
  1415
            }
0437a7cf1acc Added 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
            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
  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
              // 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
  1419
              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
  1420
              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
  1421
              {
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
  1422
                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
  1423
                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
  1424
                {
0437a7cf1acc Added 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
                  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
  1426
                  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
  1427
                  {
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
  1428
                    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
  1429
                  }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1430
                  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
  1431
                }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1432
                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
  1433
                {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1434
                  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
  1435
                }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1436
              }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1437
              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
  1438
            }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1439
          }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1440
        }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1441
        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
  1442
        {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1443
          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
  1444
        }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1445
        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
  1446
        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
  1447
        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
  1448
        {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1449
          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
  1450
        }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1451
        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
  1452
        {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1453
          thediv.className = 'tblholder';
946
ff58e1732482 AJAX: Reset votes: now uses whiteOutMiniPrompt()
Dan
parents: 907
diff changeset
  1454
          // FIXME: l10n
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
  1455
          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
  1456
          {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1457
            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
  1458
            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
  1459
            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
  1460
            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
  1461
            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
  1462
            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
  1463
          }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1464
          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
  1465
          {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1466
            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
  1467
            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
  1468
            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
  1469
            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
  1470
            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
  1471
            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
  1472
          }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1473
          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
  1474
          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
  1475
          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
  1476
          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
  1477
          
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1478
          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
  1479
          
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1480
          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
  1481
          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
  1482
          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
  1483
          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
  1484
          
946
ff58e1732482 AJAX: Reset votes: now uses whiteOutMiniPrompt()
Dan
parents: 907
diff changeset
  1485
          // FIXME: l10n
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
  1486
          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
  1487
          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
  1488
          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
  1489
          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
  1490
          
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1491
          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
  1492
          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
  1493
          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
  1494
          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
  1495
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1496
          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
  1497
          
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1498
          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
  1499
          
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1500
          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
  1501
          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
  1502
          {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1503
            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
  1504
            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
  1505
              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
  1506
            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
  1507
              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
  1508
            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
  1509
              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
  1510
            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
  1511
            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
  1512
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1513
            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
  1514
            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
  1515
            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
  1516
            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
  1517
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1518
            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
  1519
            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
  1520
            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
  1521
            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
  1522
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1523
            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
  1524
              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
  1525
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1526
            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
  1527
              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
  1528
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1529
            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
  1530
              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
  1531
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1532
            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
  1533
            {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1534
              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
  1535
              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
  1536
              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
  1537
              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
  1538
            }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1539
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1540
            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
  1541
            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
  1542
            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
  1543
            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
  1544
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1545
            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
  1546
          }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1547
          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
  1548
        }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1549
        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
  1550
        {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1551
          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
  1552
        }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1553
      }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1554
    });
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1555
}
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1556
869
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1557
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
  1558
{
560
8981dcf7d485 Added re-import function to plugin manager
Dan
parents: 555
diff changeset
  1559
  // if installing, uninstalling, or re-importing, confirm
8981dcf7d485 Added re-import function to plugin manager
Dan
parents: 555
diff changeset
  1560
  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
  1561
  {
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
  1562
    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
  1563
      {
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
  1564
        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
  1565
        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
  1566
        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
  1567
        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
  1568
        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
  1569
        
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
  1570
        // 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
  1571
        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
  1572
        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
  1573
        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
  1574
        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
  1575
        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
  1576
        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
  1577
        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
  1578
        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
  1579
        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
  1580
        
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
  1581
        // 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
  1582
        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
  1583
        
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
  1584
        // 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
  1585
        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
  1586
        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
  1587
        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
  1588
        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
  1589
        
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
  1590
        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
  1591
        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
  1592
        
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
  1593
        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
  1594
        {
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
  1595
          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
  1596
          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
  1597
          return false;
869
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1598
        };
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
  1599
        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
  1600
        {
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
  1601
          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
  1602
          return false;
869
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1603
        };
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
  1604
      });
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
  1605
    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
  1606
  }
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
  1607
  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
  1608
  // 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
  1609
  if ( btnobj )
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1610
  {
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1611
    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
  1612
    var blackbox = whiteOutElement(td);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1613
  }
869
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1614
  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
  1615
      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
  1616
      plugin: plugin_filename
869
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1617
    };
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1618
  if ( send_confirm )
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1619
  {
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1620
    request.install_confirmed = true;
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1621
  }
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1622
  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
  1623
  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
  1624
    {
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
  1625
      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
  1626
      {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1627
        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
  1628
        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
  1629
        {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1630
          handle_invalid_json(response);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1631
          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
  1632
        }
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1633
        response = parseJSON(response);
869
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1634
        if ( blackbox )
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1635
        {
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1636
          blackbox.parentNode.removeChild(blackbox);
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1637
        }
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1638
        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
  1639
        {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1640
          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
  1641
          return true;
869
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1642
        }
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1643
        if ( response.need_confirm )
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1644
        {
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1645
          miniPromptMessage({
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1646
              title: $lang.get(response.confirm_title),
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1647
              message: $lang.get(response.confirm_body),
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1648
              buttons: [
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1649
                {
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1650
                  text: $lang.get('acppl_btn_install'),
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1651
                  color: 'red',
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1652
                  style: {
1053
bdbb49cf6f1b One word: Internet Explorer 6. This includes a rewrite of $paths->parseAdminTree() that encodes to JSON instead of manually generating JS, so good-bye to stupid parser problems I hope.
Dan
parents: 946
diff changeset
  1653
                    fontWeight: 'bold'
869
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1654
                  },
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1655
                  onclick: function() {
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1656
                    ajaxPluginAction(action + '_confirm', plugin_filename, btnobj, true);
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1657
                    miniPromptDestroy(this);
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1658
                  }
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1659
                },
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1660
                {
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1661
                  text: $lang.get('etc_cancel'),
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1662
                  color: 'blue',
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1663
                  onclick: function() {
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1664
                    miniPromptDestroy(this);
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1665
                  }
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1666
                }
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1667
              ]
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1668
            });
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1669
          return true;
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1670
        }
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1671
        // 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
  1672
        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
  1673
          {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1674
            miniPrompt(function(div)
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1675
              {
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1676
                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
  1677
                {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1678
                  blackbox.parentNode.removeChild(blackbox);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1679
                }
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1680
                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
  1681
                txtholder.style.textAlign = 'center';
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1682
                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
  1683
                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
  1684
                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
  1685
                
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1686
                // close button
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1687
                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
  1688
                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
  1689
                btn_cancel.href = '#';
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1690
                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
  1691
                
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1692
                txtholder.appendChild(btn_cancel);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1693
                div.appendChild(txtholder);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1694
                
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1695
                btn_cancel.onclick = function()
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1696
                {
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1697
                  miniPromptDestroy(this);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1698
                  return false;
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1699
                }
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1700
              });
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1701
          }, 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
  1702
      }
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
  1703
    });
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
  1704
}
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1705
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1706
window.ajaxReverseDNS = function(o, text)
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1707
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1708
  if(text) var ipaddr = text;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1709
  else var ipaddr = o.innerHTML;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1710
  rDnsObj = o;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1711
  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
  1712
  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
  1713
      if ( ajax.readyState == 4 && ajax.status == 200 )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1714
      {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1715
        off = fetch_offset(rDnsObj);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1716
        dim = fetch_dimensions(rDnsObj);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1717
        right = off['left'] + dim['w'];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1718
        top = off['top'] + dim['h'];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1719
        var thediv = document.createElement('div');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1720
        thediv.className = 'info-box';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1721
        thediv.style.margin = '0';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1722
        thediv.style.position = 'absolute';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1723
        thediv.style.top  = top  + 'px';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1724
        thediv.style.display = 'none';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1725
        thediv.style.zIndex = getHighestZ() + 2;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1726
        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
  1727
        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
  1728
        var body = document.getElementsByTagName('body');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1729
        body = body[0];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1730
        bannerOff(rDnsBannerObj);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1731
        body.appendChild(thediv);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1732
        thediv.style.display = 'block';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1733
        left = fetch_dimensions(thediv);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1734
        thediv.style.display = 'none';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1735
        left = right - left['w'];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1736
        thediv.style.left = left + 'px';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1737
        thediv.style.display = 'block';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1738
        fadeInfoBoxes();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1739
      }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1740
    });
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1741
}
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1742