includes/clientside/static/faders.js
author Dan
Mon, 21 Apr 2008 19:37:31 -0400
changeset 539 1beddd693f2d
parent 537 547b7ba6d535
child 541 acb7e23b6ffa
permissions -rw-r--r--
Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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: 509
diff changeset
     1
// Message box and visual effect system
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     2
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: 509
diff changeset
     3
/**
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
     4
 * Darkens the browser screen. This will make the entire page un-clickable except for any floating divs created after this is called. Restore with enlighten().
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
     5
 * @param bool Controls whether the fade should be disabled or not. aclDisableTransitionFX will override this if set to true, and fades are never fired on IE.
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
     6
 * @param int When specified, represents the numeric opacity value to set the fade layer to. 1-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: 509
diff changeset
     7
 */
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
     8
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
     9
var darkener_index = 0;
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
    10
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: 509
diff changeset
    11
function darken(nofade, opacVal)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    12
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    13
  if(IE)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    14
    nofade = 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: 509
diff changeset
    15
  if ( !opacVal )
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
    16
    opacVal = 70;
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
    17
  darkener_index++;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    18
  if(document.getElementById('specialLayer_darkener'))
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    19
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    20
    if(nofade)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    21
    {
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: 509
diff changeset
    22
      changeOpac(opacVal, 'specialLayer_darkener');
473
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    23
      document.getElementById('specialLayer_darkener').style.display = 'block';
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: 509
diff changeset
    24
      document.getElementById('specialLayer_darkener').myOpacVal = opacVal;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    25
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    26
    else
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    27
    {
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: 509
diff changeset
    28
      if ( document.getElementById('specialLayer_darkener').style.display != 'none' )
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
    29
      {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
    30
        var currentOpac = document.getElementById('specialLayer_darkener').myOpacVal;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
    31
        opacity('specialLayer_darkener', currentOpac, opacVal, 1000);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
    32
        document.getElementById('specialLayer_darkener').myOpacVal = opacVal;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
    33
      }
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
    34
      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: 509
diff changeset
    35
      {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
    36
        document.getElementById('specialLayer_darkener').style.display = 'block';
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
    37
        document.getElementById('specialLayer_darkener').myOpacVal = opacVal;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
    38
        opacity('specialLayer_darkener', 0, opacVal, 1000);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
    39
      }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    40
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    41
  } else {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    42
    w = getWidth();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    43
    h = getHeight();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    44
    var thediv = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    45
    if(IE)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    46
      thediv.style.position = 'absolute';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    47
    else
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    48
      thediv.style.position = 'fixed';
461
717e71109645 Fixed a number of IE6 bugs
Dan
parents: 419
diff changeset
    49
    if ( IE )
717e71109645 Fixed a number of IE6 bugs
Dan
parents: 419
diff changeset
    50
    {
717e71109645 Fixed a number of IE6 bugs
Dan
parents: 419
diff changeset
    51
      var top = getScrollOffset();
717e71109645 Fixed a number of IE6 bugs
Dan
parents: 419
diff changeset
    52
      thediv.style.top = String(top) + 'px';
717e71109645 Fixed a number of IE6 bugs
Dan
parents: 419
diff changeset
    53
    }
717e71109645 Fixed a number of IE6 bugs
Dan
parents: 419
diff changeset
    54
    else
717e71109645 Fixed a number of IE6 bugs
Dan
parents: 419
diff changeset
    55
    {
717e71109645 Fixed a number of IE6 bugs
Dan
parents: 419
diff changeset
    56
      thediv.style.top = '0px';
717e71109645 Fixed a number of IE6 bugs
Dan
parents: 419
diff changeset
    57
    }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    58
    thediv.style.left = '0px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    59
    thediv.style.opacity = '0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    60
    thediv.style.filter = 'alpha(opacity=0)';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    61
    thediv.style.backgroundColor = '#000000';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    62
    thediv.style.width =  '100%';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    63
    thediv.style.height = '100%';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    64
    thediv.zIndex = getHighestZ() + 5;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    65
    thediv.id = 'specialLayer_darkener';
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: 509
diff changeset
    66
    thediv.myOpacVal = opacVal;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    67
    if(nofade)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    68
    {
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: 509
diff changeset
    69
      thediv.style.opacity = ( parseFloat(opacVal) / 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: 509
diff changeset
    70
      thediv.style.filter = 'alpha(opacity=' + opacVal + ')';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    71
      body = document.getElementsByTagName('body');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    72
      body = body[0];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    73
      body.appendChild(thediv);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    74
    } else {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    75
      body = document.getElementsByTagName('body');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    76
      body = body[0];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    77
      body.appendChild(thediv);
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: 509
diff changeset
    78
      opacity('specialLayer_darkener', 0, opacVal, 1000);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    79
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    80
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    81
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    82
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: 509
diff changeset
    83
/**
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
    84
 * Un-darkens the screen and re-enables clicking of on-screen controls.
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
    85
 * @param bool If true, disables the fade effect. Fades are always disabled if aclDisableTransitionFX is true and on IE.
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
    86
 */
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
    87
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    88
function enlighten(nofade)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    89
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    90
  if(IE)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    91
    nofade = 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
    92
  darkener_index -= 1;
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
    93
  if ( darkener_index > 0 )
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
    94
    return false;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    95
  if(document.getElementById('specialLayer_darkener'))
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    96
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    97
    if(nofade)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    98
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    99
      document.getElementById('specialLayer_darkener').style.display = 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   100
    }
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: 509
diff changeset
   101
    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: 509
diff changeset
   102
    {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   103
      var from = document.getElementById('specialLayer_darkener').myOpacVal;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   104
      // console.info('Fading from ' + from);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   105
      opacity('specialLayer_darkener', from, 0, 1000);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   106
      setTimeout("document.getElementById('specialLayer_darkener').style.display = 'none';", 1000);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   107
    }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   108
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   109
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   110
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   111
/**
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   112
 * The ultimate message box framework for Javascript
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   113
 * Syntax is (almost) identical to the MessageBox command in NSIS
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   114
 * @param int type - a bitfield consisting of the MB_* constants
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   115
 * @param string title - the blue text at the top of the window
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   116
 * @param string text - HTML for the body of the message box
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   117
 * Properties:
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   118
 *   onclick - an array of functions to be called on button click events
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   119
 *             NOTE: key names are to be strings, and they must be the value of the input, CaSe-SeNsItIvE
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   120
 *   onbeforeclick - same as onclick but called before the messagebox div is destroyed
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: 151
diff changeset
   121
 * Methods:
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: 151
diff changeset
   122
 *   destroy: kills the running message box
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   123
 * Example:
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   124
 *   var my_message = new messagebox(MB_OK|MB_ICONSTOP, 'Error logging in', 'The username and/or password is incorrect. Please check the username and retype your password');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   125
 *   my_message.onclick['OK'] = function() {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   126
 *       document.getElementById('password').value = '';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   127
 *     };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   128
 * Deps:
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   129
 *   Modern browser that supports DOM
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   130
 *   darken() and enlighten() (above)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   131
 *   opacity() - required for darken() and enlighten()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   132
 *   MB_* constants are defined in enano-lib-basic.js
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   133
 */
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   134
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   135
var mb_current_obj;
473
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   136
var mb_previously_had_darkener = false;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   137
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   138
function messagebox(type, title, message)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   139
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   140
  var y = getScrollOffset();
473
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   141
  
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   142
  // Prevent multiple instances
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   143
  if ( document.getElementById('messageBox') )
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   144
    return;
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   145
  
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   146
  if ( document.getElementById('specialLayer_darkener') )
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   147
    if ( document.getElementById('specialLayer_darkener').style.display == 'block' )
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   148
      mb_previously_had_darkener = true;
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   149
  if ( !mb_previously_had_darkener )
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   150
    darken(true);
151
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   151
  if ( aclDisableTransitionFX )
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   152
  {
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   153
    document.getElementById('specialLayer_darkener').style.zIndex = '5';
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   154
  }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   155
  var master_div = document.createElement('div');
151
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   156
  master_div.style.zIndex = '6';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   157
  var mydiv = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   158
  mydiv.style.height = '200px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   159
  w = getWidth();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   160
  h = getHeight();
151
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   161
  if ( aclDisableTransitionFX )
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   162
  {
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   163
    master_div.style.left = ((w / 2) - 200)+'px';
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   164
    master_div.style.top = ((h / 2) + y - 120)+'px';
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   165
    master_div.style.position = 'absolute';
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   166
  }
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   167
  else
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   168
  {
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   169
    master_div.style.top = '-10000px';
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   170
    master_div.style.position = ( IE ) ? 'absolute' : 'fixed';
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   171
  }
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   172
  z = ( aclDisableTransitionFX ) ? document.getElementById('specialLayer_darkener').style.zIndex : getHighestZ();
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   173
  mydiv.style.backgroundColor = '#FFFFFF';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   174
  mydiv.style.padding = '10px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   175
  mydiv.style.marginBottom = '1px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   176
  mydiv.id = 'messageBox';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   177
  mydiv.style.overflow = 'auto';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   178
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   179
  var buttondiv = document.createElement('div');
509
175df10e0b56 Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Dan
parents: 507
diff changeset
   180
  
175df10e0b56 Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Dan
parents: 507
diff changeset
   181
  if ( is_iPhone )
175df10e0b56 Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Dan
parents: 507
diff changeset
   182
  {
175df10e0b56 Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Dan
parents: 507
diff changeset
   183
    mydiv.style.width = '120px';
175df10e0b56 Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Dan
parents: 507
diff changeset
   184
    buttondiv.style.width = '120px';
175df10e0b56 Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Dan
parents: 507
diff changeset
   185
  }
175df10e0b56 Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Dan
parents: 507
diff changeset
   186
  else
175df10e0b56 Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Dan
parents: 507
diff changeset
   187
  {
175df10e0b56 Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Dan
parents: 507
diff changeset
   188
    mydiv.style.width = '400px';
175df10e0b56 Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Dan
parents: 507
diff changeset
   189
    buttondiv.style.width = '400px';
175df10e0b56 Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Dan
parents: 507
diff changeset
   190
  }
175df10e0b56 Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Dan
parents: 507
diff changeset
   191
  
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   192
  w = getWidth();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   193
  h = getHeight();
151
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   194
  if ( aclDisableTransitionFX )
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   195
  {
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   196
    //buttondiv.style.left = ((w / 2) - 200)+'px';
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   197
    //buttondiv.style.top = ((h / 2) + y + 101)+'px';
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   198
  }
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   199
  //buttondiv.style.position = ( IE ) ? 'absolute' : 'fixed';
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   200
  z = ( aclDisableTransitionFX ) ? document.getElementById('specialLayer_darkener').style.zIndex : getHighestZ();
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   201
  buttondiv.style.backgroundColor = '#C0C0C0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   202
  buttondiv.style.padding = '10px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   203
  buttondiv.style.textAlign = 'right';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   204
  buttondiv.style.verticalAlign = 'middle';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   205
  buttondiv.id = 'messageBoxButtons';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   206
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   207
  this.clickHandler = function() { messagebox_click(this, mb_current_obj); };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   208
  
38
ed06961e54dd Fixed user pages + the new .xx page URL format
Dan
parents: 32
diff changeset
   209
  if( ( type & MB_ICONINFORMATION || type & MB_ICONSTOP || type & MB_ICONQUESTION || type & MB_ICONEXCLAMATION ) && !(type & MB_ICONLOCK) )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   210
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   211
    mydiv.style.paddingLeft = '50px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   212
    mydiv.style.width = '360px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   213
    mydiv.style.backgroundRepeat = 'no-repeat';
32
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 1
diff changeset
   214
    mydiv.style.backgroundPosition = '8px 8px';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   215
  }
38
ed06961e54dd Fixed user pages + the new .xx page URL format
Dan
parents: 32
diff changeset
   216
  else if ( type & MB_ICONLOCK )
ed06961e54dd Fixed user pages + the new .xx page URL format
Dan
parents: 32
diff changeset
   217
  {
ed06961e54dd Fixed user pages + the new .xx page URL format
Dan
parents: 32
diff changeset
   218
    mydiv.style.paddingLeft = '50px';
ed06961e54dd Fixed user pages + the new .xx page URL format
Dan
parents: 32
diff changeset
   219
    mydiv.style.width = '360px';
ed06961e54dd Fixed user pages + the new .xx page URL format
Dan
parents: 32
diff changeset
   220
    mydiv.style.backgroundRepeat = 'no-repeat';
ed06961e54dd Fixed user pages + the new .xx page URL format
Dan
parents: 32
diff changeset
   221
  }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   222
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   223
  if(type & MB_ICONINFORMATION)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   224
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   225
    mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/info.png\')';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   226
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   227
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   228
  if(type & MB_ICONQUESTION)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   229
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   230
    mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/question.png\')';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   231
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   232
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   233
  if(type & MB_ICONSTOP)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   234
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   235
    mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/error.png\')';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   236
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   237
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   238
  if(type & MB_ICONEXCLAMATION)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   239
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   240
    mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/warning.png\')';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   241
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   242
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   243
  if(type & MB_ICONLOCK)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   244
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   245
    mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/lock.png\')';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   246
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   247
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   248
  if(type & MB_OK)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   249
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   250
    btn = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   251
    btn.type = 'button';
215
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   252
    btn.value = $lang.get('etc_ok');
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   253
    btn._GenericName = 'OK';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   254
    btn.onclick = this.clickHandler;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   255
    btn.style.margin = '0 3px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   256
    buttondiv.appendChild(btn);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   257
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   258
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   259
  if(type & MB_OKCANCEL)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   260
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   261
    btn = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   262
    btn.type = 'button';
215
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   263
    btn.value = $lang.get('etc_ok');
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   264
    btn._GenericName = 'OK';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   265
    btn.onclick = this.clickHandler;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   266
    btn.style.margin = '0 3px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   267
    buttondiv.appendChild(btn);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   268
    
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   269
    btn = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   270
    btn.type = 'button';
215
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   271
    btn.value = $lang.get('etc_cancel');
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   272
    btn._GenericName = 'Cancel';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   273
    btn.onclick = this.clickHandler;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   274
    btn.style.margin = '0 3px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   275
    buttondiv.appendChild(btn);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   276
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   277
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   278
  if(type & MB_YESNO)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   279
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   280
    btn = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   281
    btn.type = 'button';
215
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   282
    btn.value = $lang.get('etc_yes');
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   283
    btn._GenericName = 'Yes';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   284
    btn.onclick = this.clickHandler;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   285
    btn.style.margin = '0 3px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   286
    buttondiv.appendChild(btn);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   287
    
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   288
    btn = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   289
    btn.type = 'button';
215
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   290
    btn.value = $lang.get('etc_no');
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   291
    btn._GenericName = 'No';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   292
    btn.onclick = this.clickHandler;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   293
    btn.style.margin = '0 3px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   294
    buttondiv.appendChild(btn);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   295
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   296
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   297
  if(type & MB_YESNOCANCEL)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   298
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   299
    btn = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   300
    btn.type = 'button';
215
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   301
    btn.value = $lang.get('etc_yes');
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   302
    btn._GenericName = 'Yes';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   303
    btn.onclick = this.clickHandler;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   304
    btn.style.margin = '0 3px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   305
    buttondiv.appendChild(btn);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   306
    
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   307
    btn = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   308
    btn.type = 'button';
215
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   309
    btn.value = $lang.get('etc_no');
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   310
    btn._GenericName = 'No';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   311
    btn.onclick = this.clickHandler;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   312
    btn.style.margin = '0 3px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   313
    buttondiv.appendChild(btn);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   314
    
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   315
    btn = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   316
    btn.type = 'button';
215
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   317
    btn.value = $lang.get('etc_cancel');
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   318
    btn._GenericName = 'Cancel';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   319
    btn.onclick = this.clickHandler;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   320
    btn.style.margin = '0 3px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   321
    buttondiv.appendChild(btn);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   322
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   323
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   324
  heading = document.createElement('h2');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   325
  heading.innerHTML = title;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   326
  heading.style.color = '#50A0D0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   327
  heading.style.fontFamily = 'trebuchet ms, verdana, arial, helvetica, sans-serif';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   328
  heading.style.fontSize = '12pt';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   329
  heading.style.fontWeight = 'lighter';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   330
  heading.style.textTransform = 'lowercase';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   331
  heading.style.marginTop = '0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   332
  mydiv.appendChild(heading);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   333
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   334
  var text = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   335
  text.innerHTML = String(message);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   336
  this.text_area = text;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   337
  mydiv.appendChild(text);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   338
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   339
  this.updateContent = function(text)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   340
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   341
      this.text_area.innerHTML = text;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   342
    };
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: 151
diff changeset
   343
    
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: 151
diff changeset
   344
  this.destroy = function()
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: 151
diff changeset
   345
    {
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: 151
diff changeset
   346
      var mbdiv = document.getElementById('messageBox');
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: 151
diff changeset
   347
      mbdiv.parentNode.removeChild(mbdiv.nextSibling);
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: 151
diff changeset
   348
      mbdiv.parentNode.removeChild(mbdiv);
473
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   349
      if ( !mb_previously_had_darkener )
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   350
        enlighten(true);
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: 151
diff changeset
   351
    };
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   352
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   353
  //domObjChangeOpac(0, mydiv);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   354
  //domObjChangeOpac(0, master_div);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   355
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   356
  body = document.getElementsByTagName('body');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   357
  body = body[0];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   358
  master_div.appendChild(mydiv);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   359
  master_div.appendChild(buttondiv);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   360
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   361
  body.appendChild(master_div);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   362
  
151
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   363
  if ( !aclDisableTransitionFX )
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   364
    setTimeout('mb_runFlyIn();', 100);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   365
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   366
  this.onclick = new Array();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   367
  this.onbeforeclick = new Array();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   368
  mb_current_obj = this;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   369
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   370
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   371
function mb_runFlyIn()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   372
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   373
  var mydiv = document.getElementById('messageBox');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   374
  var maindiv = mydiv.parentNode;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   375
  fly_in_top(maindiv, true, false);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   376
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   377
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   378
function messagebox_click(obj, mb)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   379
{
215
94db56b8124f Localized the sidebar
Dan
parents: 210
diff changeset
   380
  val = ( typeof ( obj._GenericName ) == 'string' ) ? obj._GenericName : obj.value;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   381
  if(typeof mb.onbeforeclick[val] == 'function')
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   382
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   383
    var o = mb.onbeforeclick[val];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   384
    var resp = o();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   385
    if ( resp )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   386
      return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   387
    o = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   388
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   389
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   390
  var mydiv = document.getElementById('messageBox');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   391
  var maindiv = mydiv.parentNode;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   392
  
151
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   393
  if ( aclDisableTransitionFX )
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   394
  {
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   395
    var mbdiv = document.getElementById('messageBox');
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   396
    mbdiv.parentNode.removeChild(mbdiv.nextSibling);
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   397
    mbdiv.parentNode.removeChild(mbdiv);
473
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   398
    if ( !mb_previously_had_darkener )
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   399
      enlighten(true);
151
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   400
  }
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   401
  else
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   402
  {
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   403
    var to = fly_out_top(maindiv, true, false);
473
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   404
    setTimeout("var mbdiv = document.getElementById('messageBox'); mbdiv.parentNode.removeChild(mbdiv.nextSibling); mbdiv.parentNode.removeChild(mbdiv); if ( !mb_previously_had_darkener ) enlighten(true);", to);
151
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 53
diff changeset
   405
  }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   406
  if(typeof mb.onclick[val] == 'function')
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   407
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   408
    o = mb.onclick[val];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   409
    o();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   410
    o = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   411
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   412
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   413
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   414
function testMessageBox()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   415
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   416
  mb = new messagebox(MB_OKCANCEL|MB_ICONINFORMATION, 'Javascripted dynamic message boxes', 'This is soooooo coool, now if only document.createElement() worked in IE!<br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   417
  mb.onclick['OK'] = function()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   418
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   419
      alert('You clicked OK!');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   420
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   421
  mb.onbeforeclick['Cancel'] = function()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   422
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   423
      alert('You clicked Cancel!');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   424
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   425
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   426
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: 509
diff changeset
   427
/**
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   428
 * The miniPrompt function, for creating small prompts and dialogs. The window will be flown in and the window darkened with opac=0.4.
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   429
 * @param function Will be passed an HTMLElement that is the body of the prompt window; the function can do with this as it pleases
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   430
 */
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   431
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   432
function miniPrompt(call_on_create)
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   433
{
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   434
  darken(false, 40);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   435
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   436
  var wrapper = 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: 509
diff changeset
   437
  wrapper.className = 'miniprompt';
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   438
  var top = 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: 509
diff changeset
   439
  top.className = 'mp-top';
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   440
  var body = 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: 509
diff changeset
   441
  body.className = 'mp-body';
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   442
  var bottom = 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: 509
diff changeset
   443
  bottom.className = 'mp-bottom';
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   444
  if ( typeof(call_on_create) == '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: 509
diff changeset
   445
  {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   446
    call_on_create(body);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   447
  }
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   448
  wrapper.appendChild(top);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   449
  wrapper.appendChild(body);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   450
  wrapper.appendChild(bottom);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   451
  var left = ( getWidth() / 2 ) - ( 388 / 2 );
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   452
  wrapper.style.left = left + 'px';
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   453
  var top = getScrollOffset() - 27;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   454
  wrapper.style.top = top + 'px';
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   455
  domObjChangeOpac(0, wrapper);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   456
  var realbody = document.getElementsByTagName('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: 509
diff changeset
   457
  realbody.appendChild(wrapper);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   458
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   459
  fly_in_top(wrapper, true, 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: 509
diff changeset
   460
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   461
  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: 509
diff changeset
   462
    {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   463
      domObjChangeOpac(100, wrapper);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   464
    }, 40);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   465
}
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   466
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   467
/**
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   468
 * For a given element, loops through the element and all of its ancestors looking for a miniPrompt div, and returns it. Returns false on failure.
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   469
 * @param object:HTMLElement Child node to scan
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   470
 * @return object
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   471
 */
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   472
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   473
function 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: 509
diff changeset
   474
{
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   475
  while ( 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: 509
diff changeset
   476
  {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   477
    // prevent infinite loops
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   478
    if ( !obj || obj.tagName == 'BODY' )
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   479
      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: 509
diff changeset
   480
    
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   481
    if ( $dynano(obj).hasClass('miniprompt') )
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   482
    {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   483
      return 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: 509
diff changeset
   484
    }
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   485
    obj = obj.parentNode;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   486
  }
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   487
  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: 509
diff changeset
   488
}
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   489
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   490
/**
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   491
 * Destroys the first miniPrompt div encountered by recursively checking all parent nodes.
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   492
 * Usage: <a href="javascript:miniPromptDestroy(this);">click</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: 509
diff changeset
   493
 * @param object:HTMLElement a child of the div.miniprompt
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   494
 * @param bool If true, does not call enlighten().
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   495
 */
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   496
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   497
function miniPromptDestroy(obj, nofade)
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   498
{
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   499
  obj = 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: 509
diff changeset
   500
  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: 509
diff changeset
   501
    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: 509
diff changeset
   502
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   503
  // found it
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   504
  var parent = obj.parentNode;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   505
  if ( !nofade )
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   506
    enlighten();
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   507
  var timeout = fly_out_top(obj, true, 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: 509
diff changeset
   508
  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: 509
diff changeset
   509
    {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   510
      parent.removeChild(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: 509
diff changeset
   511
    }, timeout);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   512
}
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   513
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   514
/**
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   515
 * Simple test case
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   516
 */
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   517
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   518
function miniPromptTest()
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   519
{
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   520
  miniPrompt(function(div) { div.innerHTML = 'hello world! <a href="#" onclick="miniPromptDestroy(this); return false;">destroy me</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: 509
diff changeset
   521
}
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 509
diff changeset
   522
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: 522
diff changeset
   523
/**
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: 522
diff changeset
   524
 * Message box system for miniPrompts. Less customization but easier to scale than the regular messageBox framework.
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: 522
diff changeset
   525
 * @example
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: 522
diff changeset
   526
 <code>
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: 522
diff changeset
   527
 miniPromptMessage({
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: 522
diff changeset
   528
   title: 'Delete page',
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: 522
diff changeset
   529
   message: 'Do you really want to delete this page? This is reversible unless you clear the page logs.',
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: 522
diff changeset
   530
   buttons: [
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: 522
diff changeset
   531
     {
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: 522
diff changeset
   532
       text: 'Delete',
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: 522
diff changeset
   533
       color: 'red',
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: 522
diff changeset
   534
       style: {
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: 522
diff changeset
   535
         fontWeight: 'bold'
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: 522
diff changeset
   536
       },
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: 522
diff changeset
   537
       onclick: function() {
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: 522
diff changeset
   538
         ajaxDeletePage();
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: 522
diff changeset
   539
         miniPromptDestroy(this);
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: 522
diff changeset
   540
       }
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: 522
diff changeset
   541
     },
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: 522
diff changeset
   542
     {
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: 522
diff changeset
   543
       text: 'cancel',
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: 522
diff changeset
   544
       onclick: function() {
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: 522
diff changeset
   545
         miniPromptDestroy(this);
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: 522
diff changeset
   546
       }
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: 522
diff changeset
   547
     }
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: 522
diff changeset
   548
   ]
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: 522
diff changeset
   549
 });
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: 522
diff changeset
   550
 </code>
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: 522
diff changeset
   551
 */
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: 522
diff changeset
   552
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: 522
diff changeset
   553
function miniPromptMessage(parms)
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: 522
diff changeset
   554
{
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: 522
diff changeset
   555
  if ( !parms.title || !parms.message || !parms.buttons )
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: 522
diff changeset
   556
    return false;
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: 522
diff changeset
   557
  
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: 522
diff changeset
   558
  return miniPrompt(function(parent)
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: 522
diff changeset
   559
    {
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: 522
diff changeset
   560
      try
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: 522
diff changeset
   561
      {
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: 522
diff changeset
   562
        var h3 = document.createElement('h3');
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: 522
diff changeset
   563
        h3.appendChild(document.createTextNode(parms.title));
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: 522
diff changeset
   564
        var body = document.createElement('p');
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: 522
diff changeset
   565
        var message = parms.message.split(unescape('%0A'));
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: 522
diff changeset
   566
        for ( var i = 0; i < message.length; i++ )
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: 522
diff changeset
   567
        {
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: 522
diff changeset
   568
          body.appendChild(document.createTextNode(message[i]));
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: 522
diff changeset
   569
          if ( i + 1 < message.length )
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: 522
diff changeset
   570
            body.appendChild(document.createElement('br'));
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: 522
diff changeset
   571
        }
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: 522
diff changeset
   572
        
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: 522
diff changeset
   573
        parent.style.textAlign = 'center';
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: 522
diff changeset
   574
        
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: 522
diff changeset
   575
        parent.appendChild(h3);
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: 522
diff changeset
   576
        parent.appendChild(body);
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: 522
diff changeset
   577
        parent.appendChild(document.createElement('br'));
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: 522
diff changeset
   578
        
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: 522
diff changeset
   579
        // construct buttons
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: 522
diff changeset
   580
        for ( var i = 0; i < parms.buttons.length; i++ )
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: 522
diff changeset
   581
        {
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: 522
diff changeset
   582
          var button = parms.buttons[i];
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: 522
diff changeset
   583
          button.input = document.createElement('a');
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: 522
diff changeset
   584
          button.input.href = '#';
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: 522
diff changeset
   585
          button.input.clickAction = button.onclick;
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: 522
diff changeset
   586
          button.input.className = 'abutton';
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: 522
diff changeset
   587
          if ( button.color )
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: 522
diff changeset
   588
          {
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: 522
diff changeset
   589
            button.input.className += ' abutton_' + button.color;
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: 522
diff changeset
   590
          }
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: 522
diff changeset
   591
          button.input.appendChild(document.createTextNode(button.text));
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: 522
diff changeset
   592
          if ( button.style )
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: 522
diff changeset
   593
          {
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: 522
diff changeset
   594
            for ( var j in button.style )
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: 522
diff changeset
   595
            {
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: 522
diff changeset
   596
              button.input.style[j] = button.style[j];
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: 522
diff changeset
   597
            }
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: 522
diff changeset
   598
          }
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: 522
diff changeset
   599
          button.input.onclick = function(e)
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: 522
diff changeset
   600
          {
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: 522
diff changeset
   601
            try
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: 522
diff changeset
   602
            {
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: 522
diff changeset
   603
              this.clickAction(e);
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: 522
diff changeset
   604
            }
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: 522
diff changeset
   605
            catch(e)
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: 522
diff changeset
   606
            {
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: 522
diff changeset
   607
              console.error(e);
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: 522
diff changeset
   608
            }
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: 522
diff changeset
   609
            return false;
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: 522
diff changeset
   610
          }
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: 522
diff changeset
   611
          parent.appendChild(button.input);
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: 522
diff changeset
   612
        }
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: 522
diff changeset
   613
        if ( parms.buttons[0] )
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: 522
diff changeset
   614
        {
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: 522
diff changeset
   615
          setTimeout(function()
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: 522
diff changeset
   616
            {
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: 522
diff changeset
   617
              parms.buttons[0].input.focus();
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: 522
diff changeset
   618
            }, 300);
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: 522
diff changeset
   619
        }
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: 522
diff changeset
   620
      }
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: 522
diff changeset
   621
      catch ( e )
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: 522
diff changeset
   622
      {
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: 522
diff changeset
   623
        console.error(e);
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: 522
diff changeset
   624
      }
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: 522
diff changeset
   625
    });
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: 522
diff changeset
   626
}
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: 522
diff changeset
   627
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: 522
diff changeset
   628
function testMPMessageBox()
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: 522
diff changeset
   629
{
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: 522
diff changeset
   630
  miniPromptMessage({
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: 522
diff changeset
   631
    title: 'The Game of LIFE question #73',
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: 522
diff changeset
   632
    message: 'You just got your girlfriend pregnant. Please select an option:',
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: 522
diff changeset
   633
    buttons: [
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: 522
diff changeset
   634
      {
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: 522
diff changeset
   635
        text: 'Abort',
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: 522
diff changeset
   636
        color: 'red',
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: 522
diff changeset
   637
        style: {
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: 522
diff changeset
   638
          fontWeight: 'bold'
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: 522
diff changeset
   639
        },
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: 522
diff changeset
   640
        onclick: function() {
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: 522
diff changeset
   641
          miniPromptDestroy(this);
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: 522
diff changeset
   642
        }
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: 522
diff changeset
   643
      },
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: 522
diff changeset
   644
      {
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: 522
diff changeset
   645
        text: 'Retry',
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: 522
diff changeset
   646
        color: 'blue',
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: 522
diff changeset
   647
        onclick: function() {
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: 522
diff changeset
   648
          miniPromptDestroy(this);
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: 522
diff changeset
   649
        }
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: 522
diff changeset
   650
      },
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: 522
diff changeset
   651
      {
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: 522
diff changeset
   652
        text: 'Ignore',
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: 522
diff changeset
   653
        color: 'green',
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: 522
diff changeset
   654
        onclick: function() {
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: 522
diff changeset
   655
          miniPromptDestroy(this);
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: 522
diff changeset
   656
        }
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: 522
diff changeset
   657
      }
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: 522
diff changeset
   658
    ]
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: 522
diff changeset
   659
  });
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: 522
diff changeset
   660
}
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: 522
diff changeset
   661
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   662
// Function to fade classes info-box, warning-box, error-box, etc.
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   663
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   664
function fadeInfoBoxes()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   665
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   666
  var divs = new Array();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   667
  d = document.getElementsByTagName('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   668
  j = 0;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   669
  for(var i in d)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   670
  {
419
b8b4e38825db Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents: 326
diff changeset
   671
    if ( !d[i] )
b8b4e38825db Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents: 326
diff changeset
   672
      continue;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   673
    if ( !d[i].tagName )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   674
      continue;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   675
    if(d[i].className=='info-box' || d[i].className=='error-box' || d[i].className=='warning-box' || d[i].className=='question-box')
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   676
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   677
      divs[j] = d[i];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   678
      j++;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   679
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   680
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   681
  if(divs.length < 1) return;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   682
  for(i in divs)
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
    if(!divs[i].id) divs[i].id = 'autofade_'+Math.floor(Math.random() * 100000);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   685
    switch(divs[i].className)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   686
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   687
      case 'info-box':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   688
      default:
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   689
        from = '#3333FF';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   690
        break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   691
      case 'error-box':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   692
        from = '#FF3333';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   693
        break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   694
      case 'warning-box':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   695
        from = '#FFFF33';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   696
        break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   697
      case 'question-box':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   698
        from = '#33FF33';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   699
        break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   700
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   701
    Fat.fade_element(divs[i].id,30,2000,from,Fat.get_bgcolor(divs[i].id));
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   702
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   703
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   704
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   705
// Alpha fades
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   706
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   707
function opacity(id, opacStart, opacEnd, millisec) {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   708
    //speed for each frame
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   709
    var speed = Math.round(millisec / 100);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   710
    var timer = 0;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   711
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   712
    //determine the direction for the blending, if start and end are the same nothing happens
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   713
    if(opacStart > opacEnd) {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   714
        for(i = opacStart; i >= opacEnd; i--) {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   715
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   716
            timer++;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   717
        }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   718
    } else if(opacStart < opacEnd) {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   719
        for(i = opacStart; i <= opacEnd; i++)
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
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   722
            timer++;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   723
        }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   724
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   725
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   726
53
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   727
var opacityDOMCache = new Object();
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   728
function domOpacity(obj, opacStart, opacEnd, millisec) {
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   729
    //speed for each frame
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   730
    var speed = Math.round(millisec / 100);
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   731
    var timer = 0;
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   732
    
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   733
    // unique ID for this animation
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   734
    var uniqid = Math.floor(Math.random() * 1000000);
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   735
    opacityDOMCache[uniqid] = obj;
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   736
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   737
    //determine the direction for the blending, if start and end are the same nothing happens
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   738
    if(opacStart > opacEnd) {
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   739
        for(i = opacStart; i >= opacEnd; i--) {
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   740
            setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed));
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   741
            timer++;
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   742
        }
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   743
    } else if(opacStart < opacEnd) {
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   744
        for(i = opacStart; i <= opacEnd; i++)
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   745
            {
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   746
            setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed));
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   747
            timer++;
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   748
        }
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   749
    }
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   750
    setTimeout("delete(opacityDOMCache["+uniqid+"]);",(timer * speed));
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   751
}
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   752
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   753
//change the opacity for different browsers
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   754
function changeOpac(opacity, id) {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   755
    var object = document.getElementById(id).style;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   756
    object.opacity = (opacity / 100);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   757
    object.MozOpacity = (opacity / 100);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   758
    object.KhtmlOpacity = (opacity / 100);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   759
    object.filter = "alpha(opacity=" + opacity + ")";
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   760
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   761
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   762
function mb_logout()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   763
{
210
2b283402e4e4 Added language export to JSON page and localization for Javascript using $lang.get(). Localized AJAX login interface.
Dan
parents: 151
diff changeset
   764
  var mb = new messagebox(MB_YESNO|MB_ICONQUESTION, $lang.get('user_logout_confirm_title'), $lang.get('user_logout_confirm_body'));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   765
  mb.onclick['Yes'] = function()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   766
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   767
      window.location = makeUrlNS('Special', 'Logout/' + title);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   768
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   769
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   770
507
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   771
function whiteOutElement(el)
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   772
{
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   773
  var top = $(el).Top();
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   774
  var left = $(el).Left();
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   775
  var width = $(el).Width();
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   776
  var height = $(el).Height();
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   777
  
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   778
  var blackout = document.createElement('div');
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   779
  blackout.style.position = 'absolute';
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   780
  blackout.style.top = top + 'px';
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   781
  blackout.style.left = left + 'px';
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   782
  blackout.style.width = width + 'px';
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   783
  blackout.style.height = height + 'px';
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   784
  
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   785
  blackout.style.backgroundColor = '#FFFFFF';
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   786
  domObjChangeOpac(60, blackout);
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   787
  blackout.style.backgroundImage = 'url(' + scriptPath + '/includes/clientside/tinymce/themes/advanced/skins/default/img/progress.gif)';
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   788
  blackout.style.backgroundPosition = 'center center';
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   789
  blackout.style.backgroundRepeat = 'no-repeat';
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   790
  blackout.style.zIndex = getHighestZ() + 2;
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   791
  
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   792
  var body = document.getElementsByTagName('body')[0];
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   793
  body.appendChild(blackout);
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   794
  
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   795
  return blackout;
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   796
}
586fd7d3202d Fixed some stray version numbers (again!); added support for Diffie-Hellman logins in the normal login form (not AJAX) - even works in IE
Dan
parents: 473
diff changeset
   797