includes/clientside/static/paginate.js
author Dan
Fri, 18 Dec 2009 19:06:49 -0500
changeset 1175 1e2c9819ede3
parent 1173 b5b8e7ab0914
child 1227 bdac73ed481e
permissions -rw-r--r--
Logs: Fully integrated an author_uid column. Logs are now linked by user ID instead of just username, so they survive username changes better. Database is changed. Fixes issue 6.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
     1
// Javascript pagination control
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
     2
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
     3
/**
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
     4
 * Paginates an array of data.
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
     5
 * @param array List of objects to render
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
     6
 * @param function Function called on each member of the array to render, should take an array member and set this.html to a string
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
     7
 * @param int Optional. Object to start at, defaults to 0.
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
     8
 * @param int Optional. Objects per page, defaults to 10
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
     9
 * @param object Variable that will be passed to the renderer callback
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    10
 */
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    11
 
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    12
var pagin_objects = new Object();
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    13
1173
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    14
window.paginator = function(data, callback, offset, perpage, passer, ov_num_pages, ov_flip_func)
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    15
{
594
738c61b498a6 A little more optimization work, client-side this time. I lied, no librijnadel2 here, but it's about to be merged in...
Dan
parents: 582
diff changeset
    16
  load_component('flyin');
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    17
  if ( !perpage || typeof(perpage) != 'number' || ( typeof(perpage) == 'number' && perpage < 1 ) )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    18
  {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    19
    this.perpage = 10;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    20
  }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    21
  else
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    22
  {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    23
    this.perpage = perpage;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    24
  }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    25
  if ( typeof(offset) != 'number' )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    26
    this.offset = 0;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    27
  else
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    28
    this.offset = offset;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    29
  if ( typeof(passer) != 'undefined' )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    30
    this.passer = passer;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    31
  else
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    32
    this.passer = false;
1173
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    33
  if ( ov_num_pages )
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    34
  {
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    35
    this.num_pages = ov_num_pages;
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    36
    this.flip_func = ov_flip_func;
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    37
  }
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    38
  else
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    39
  {
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    40
    this.num_pages = Math.ceil(data.length / perpage);
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    41
    this.flip_func = false;
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    42
  }
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    43
  this.random_id = 'autopagin_' + Math.floor(Math.random() * 1000000);
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    44
  this._build_control = _build_paginator;
1173
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    45
  this.set_page = function(number)
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    46
  {
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    47
    this.offset = number * this.perpage;
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    48
    var html = this._build_control(number);
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    49
    var elements = getElementsByClassName(document.body, 'div', this.random_id + '_control');
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    50
    for ( var i = 0; i < elements.length; i++ )
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    51
      elements[i].innerHTML = html;
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    52
  }
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    53
  if ( this.num_pages > 1 )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    54
  {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    55
    var pg_control = '<div class="'+this.random_id+'_control">'+this._build_control(0)+'</div>';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    56
  }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    57
  else
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    58
  {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    59
    var pg_control = '';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    60
  }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    61
  this.html = pg_control;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    62
  var i = 0;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    63
  while ( i < data.length )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    64
  {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    65
    if ( i % this.perpage == 0 )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    66
    {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    67
      if ( i > 0 )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    68
        this.html += '</div>';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    69
      var display = ( ( i * this.perpage ) == this.offset ) ? '' : 'display: none;';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    70
      var thispage = Math.floor(i / this.perpage);
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    71
      this.html += '<div id="' + this.random_id + '_' + thispage + '" style="' + display + '">';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    72
    }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    73
    this.html += callback(data[i], this.passer);
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    74
    i++;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    75
  }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    76
  this.html += '</div>';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    77
  this.html += pg_control;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    78
  pagin_objects[this.random_id] = this;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    79
}
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    80
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
    81
/**
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
    82
 * Yet another demonstration of the fact that with the right tools, any amount of Javascript can be ported from PHP.
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
    83
 * @access private
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
    84
 */
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
    85
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
    86
window._build_paginator = function(this_page)
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    87
{
1173
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
    88
  var div_styling = ( IE ) ? 'width: 1px; margin: 10px auto 10px 0;' : 'display: table; margin: 10px 0 10px auto;';
359
e0787bb6285b Implemented IP logging for comments and registration
Dan
parents: 98
diff changeset
    89
  var begin = '<div class="tblholder" style="'+div_styling+'"><table border="0" cellspacing="1" cellpadding="4"><tr><th>' + $lang.get('paginate_lbl_page') + '</th>';
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
    90
  var block = '<td class="row1" style="text-align: center; white-space: nowrap;">{LINK}</td>';
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    91
  var end = '</tr></table></div>';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    92
  var blk = new templateParser(block);
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    93
  var inner = '';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    94
  var cls = 'row2';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    95
  
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
    96
  if ( this_page > 0 )
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
    97
  {
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
    98
    var url = '#page_'+(this_page);
359
e0787bb6285b Implemented IP logging for comments and registration
Dan
parents: 98
diff changeset
    99
    var link = "<a href=\""+url+"\" onclick=\"jspaginator_goto('"+this.random_id+"', "+(this_page-1)+"); return false;\" style='text-decoration: none;'>&laquo; " + $lang.get('paginate_btn_prev') + "</a>";
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   100
    cls = ( cls == 'row1' ) ? 'row2' : 'row1';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   101
    blk.assign_vars({
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   102
        CLASS: cls,
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   103
        LINK: link
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   104
      });
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   105
    inner += blk.run();
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   106
  }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   107
  if ( this.num_pages < 5 )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   108
  {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   109
    for ( var i = 0; i < this.num_pages; i++ )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   110
    {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   111
      cls = ( cls == 'row1' ) ? 'row2' : 'row1';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   112
      var j = i + 1;
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   113
      var url = '#page_'+j;
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   114
      var link = ( i == this_page ) ? "<b>"+j+"</b>" : "<a href=\""+url+"\" onclick=\"jspaginator_goto('"+this.random_id+"', "+i+"); return false;\" style='text-decoration: none;'>"+j+"</a>";
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   115
      blk.assign_vars({
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   116
          CLASS: cls,
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   117
          LINK: link
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   118
        });
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   119
      inner += blk.run();
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   120
    }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   121
  }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   122
  else
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   123
  {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   124
    if ( this_page + 5 > this.num_pages )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   125
    {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   126
      var list = new Array();
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   127
      var tp = this_page;                    // The vectors below used to be 3, 2, and 1
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   128
      if ( this_page + 0 == this.num_pages ) tp = tp - 2;
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   129
      if ( this_page + 1 == this.num_pages ) tp = tp - 1;
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   130
      if ( this_page + 2 == this.num_pages ) tp = tp - 0;
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   131
      for ( var i = tp - 1; i <= tp + 1; i++ )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   132
      {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   133
        list.push(i);
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   134
      }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   135
    }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   136
    else
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   137
    {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   138
      var list = new Array();
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   139
      var current = this_page;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   140
      var lower = ( current < 3 ) ? 1 : current - 1;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   141
      for ( var i = 0; i < 3; i++ )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   142
      {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   143
        list.push(lower + i);
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   144
      }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   145
    }
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   146
    var url = '#page_1';
359
e0787bb6285b Implemented IP logging for comments and registration
Dan
parents: 98
diff changeset
   147
    var link = ( 0 == this_page ) ? "<b>" + $lang.get('paginate_btn_first') + "</b>" : "<a href=\""+url+"\" onclick=\"jspaginator_goto('"+this.random_id+"', 0); return false;\" style='text-decoration: none;'>&laquo; " + $lang.get('paginate_btn_first') + "</a>";
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   148
    blk.assign_vars({
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   149
        CLASS: cls,
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   150
        LINK: link
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   151
      });
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   152
    inner += blk.run();
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   153
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   154
    // if ( !in_array(1, $list) )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   155
    // {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   156
    //   $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   157
    //   $blk->assign_vars(array('CLASS'=>$cls,'LINK'=>'...'));
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   158
    //   $inner .= $blk->run();
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   159
    // }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   160
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   161
    for ( var k in list )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   162
    {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   163
      var i = list[k];
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   164
      if ( i == this.num_pages )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   165
        break;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   166
      cls = ( cls == 'row1' ) ? 'row2' : 'row1';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   167
      var j = i + 1;
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   168
      var url = '#page_'+j;
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   169
      var link = ( i == this_page ) ? "<b>"+j+"</b>" : "<a href=\""+url+"\" onclick=\"jspaginator_goto('"+this.random_id+"', "+i+"); return false;\" style='text-decoration: none;'>"+j+"</a>";
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   170
      blk.assign_vars({
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   171
          CLASS: cls,
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   172
          LINK: link
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   173
        });
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   174
      inner += blk.run();
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   175
    }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   176
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   177
    if ( this_page < this.num_pages )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   178
    {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   179
      // $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   180
      // $blk->assign_vars(array('CLASS'=>$cls,'LINK'=>'...'));
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   181
      // $inner .= $blk->run();
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   182
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   183
      cls = ( cls == 'row1' ) ? 'row2' : 'row1';
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   184
      var url = '#page_' + String( this.num_pages-1 );
359
e0787bb6285b Implemented IP logging for comments and registration
Dan
parents: 98
diff changeset
   185
      var link = ( ( this.num_pages - 1 ) == this_page ) ? "<b>" + $lang.get('paginate_btn_last') + "</b>" : "<a href=\""+url+"\" onclick=\"jspaginator_goto('"+this.random_id+"', "+(this.num_pages-1)+"); return false;\" style='text-decoration: none;'>" + $lang.get('paginate_btn_last') + " &raquo;</a>";
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   186
      blk.assign_vars({
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   187
          CLASS: cls,
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   188
          LINK: link
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   189
        });
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   190
      inner += blk.run();
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   191
    }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   192
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   193
  }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   194
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   195
  if ( this_page < ( this.num_pages - 1 ) )
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   196
  {
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   197
    var url = '#page_' + String(this_page + 2);
359
e0787bb6285b Implemented IP logging for comments and registration
Dan
parents: 98
diff changeset
   198
    var link = "<a href=\""+url+"\" onclick=\"jspaginator_goto('"+this.random_id+"', "+(this_page+1)+"); return false;\" style='text-decoration: none;'>" + $lang.get('paginate_btn_next') + " &raquo;</a>";
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   199
    cls = ( cls == 'row1' ) ? 'row2' : 'row1';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   200
    blk.assign_vars({
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   201
          CLASS: cls,
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   202
          LINK: link
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   203
        });
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   204
      inner += blk.run();
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   205
  }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   206
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   207
  inner += '<td class="row2" style="cursor: pointer;" onclick="paginator_goto(this, '+this_page+', '+this.num_pages+', '+this.perpage+', {js: true, random_id: \''+this.random_id+'\'});">&darr;</td>';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   208
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   209
  var paginator = "\n"+begin+inner+end+"\n";
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   210
  return paginator;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   211
  
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   212
}
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   213
98
6457a9b983c6 Fixed non-object reference in databaseless template, added locking for Javascript paginator, made comments on AES key size more clear in constants, and disallowed "anonymous" and IP addresses for admin username in install.php; Loch Ness release candidate
Dan
parents: 86
diff changeset
   214
var __paginateLock = false;
6457a9b983c6 Fixed non-object reference in databaseless template, added locking for Javascript paginator, made comments on AES key size more clear in constants, and disallowed "anonymous" and IP addresses for admin username in install.php; Loch Ness release candidate
Dan
parents: 86
diff changeset
   215
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   216
window.jspaginator_goto = function(pagin_id, jump_to)
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   217
{
98
6457a9b983c6 Fixed non-object reference in databaseless template, added locking for Javascript paginator, made comments on AES key size more clear in constants, and disallowed "anonymous" and IP addresses for admin username in install.php; Loch Ness release candidate
Dan
parents: 86
diff changeset
   218
  if ( __paginateLock )
6457a9b983c6 Fixed non-object reference in databaseless template, added locking for Javascript paginator, made comments on AES key size more clear in constants, and disallowed "anonymous" and IP addresses for admin username in install.php; Loch Ness release candidate
Dan
parents: 86
diff changeset
   219
    return false;
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   220
  var theobj = pagin_objects[pagin_id];
1173
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
   221
  if ( theobj.flip_func )
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
   222
  {
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
   223
    theobj.flip_func(theobj, jump_to);
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
   224
    __paginateLock = false;
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
   225
    return true;
b5b8e7ab0914 Comments (AJAX): Now paginated server side. Fixes issue 2.
Dan
parents: 1132
diff changeset
   226
  }
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   227
  var current_div = false;
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   228
  var new_div = false;
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   229
  for ( var i = 0; i < theobj.num_pages; i++ )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   230
  {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   231
    var thediv = document.getElementById(pagin_id + '_' + i);
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   232
    if ( !thediv )
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   233
    {
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   234
      // if ( window.console )
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   235
        // window.console.error('jspaginator_goto(): got a bad DOM object in loop');
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   236
      return false;
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   237
    }
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   238
    // window.console.debug("Div "+i+' of '+(theobj.num_pages-1)+': ', thediv);
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   239
    if ( thediv.style.display != 'none' )
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   240
      current_div = thediv;
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   241
    else if ( i == jump_to )
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   242
      new_div = thediv;
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   243
  }
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   244
  
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   245
  if ( !new_div )
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   246
  {
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   247
    // if ( window.console )
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   248
      // window.console.error('jspaginator_goto(): didn\'t get new div');
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   249
    return false;
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   250
  }
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   251
  if ( !current_div )
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   252
  {
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   253
    // if ( window.console )
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   254
      // window.console.error('jspaginator_goto(): didn\'t get current div');
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   255
    return false;
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   256
  }
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   257
  
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   258
  // window.console.debug(current_div);
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   259
  // window.console.debug(new_div);
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   260
  
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   261
  // White-out the old div and fade in the new one
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   262
  
1132
05fe0039d952 Logins: reorganized data structures a bit. WiP - needs test routine done.
Dan
parents: 909
diff changeset
   263
  if ( IE || is_Safari || aclDisableTransitionFX )
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   264
  {
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   265
    current_div.style.display = 'none';
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   266
    new_div.style.display = 'block';
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   267
  }
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   268
  else
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   269
  {
98
6457a9b983c6 Fixed non-object reference in databaseless template, added locking for Javascript paginator, made comments on AES key size more clear in constants, and disallowed "anonymous" and IP addresses for admin username in install.php; Loch Ness release candidate
Dan
parents: 86
diff changeset
   270
    __paginateLock = true;
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   271
    var fade_time = 375;
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   272
    var code = 'var old = \'' + current_div.id + '\';';
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   273
    code    += 'var newer = \'' + new_div.id + '\';';
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   274
    code    += 'document.getElementById(old).style.display = "none";';
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   275
    code    += 'changeOpac(0, newer);';
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   276
    code    += 'document.getElementById(newer).style.display = "block";';
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   277
    code    += 'opacity(newer, 0, 100, '+fade_time+');';
98
6457a9b983c6 Fixed non-object reference in databaseless template, added locking for Javascript paginator, made comments on AES key size more clear in constants, and disallowed "anonymous" and IP addresses for admin username in install.php; Loch Ness release candidate
Dan
parents: 86
diff changeset
   278
    code    += '__paginateLock = false;';
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   279
    // if ( window.console )
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   280
      // window.console.debug('metacode for fader: ', code);
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   281
    opacity(current_div.id, 100, 0, fade_time);
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   282
    setTimeout(code, (fade_time + 50));
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   283
  }
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   284
  
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 85
diff changeset
   285
  
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   286
  var pg_control = theobj._build_control(jump_to);
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   287
  var divs = getElementsByClassName(document, 'div', pagin_id + '_control');
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   288
  for ( var i = 0; i < divs.length; i++ )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   289
  {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   290
    divs[i].innerHTML = pg_control;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   291
  }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   292
}
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   293
909
94c1ff984286 Finished core of log display interface including filter management. There is still a bit of a to-do list, especially regarding rollbacks and reuploads.
Dan
parents: 875
diff changeset
   294
window.paginator_goto = function(parentobj, this_page, num_pages, perpage, additive, url_string)
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   295
{
789
4a8fc835ba02 Added paginator_goto() to function reverse map; fixed some missing component loads in pagination code
Dan
parents: 594
diff changeset
   296
  load_component('flyin');
4a8fc835ba02 Added paginator_goto() to function reverse map; fixed some missing component loads in pagination code
Dan
parents: 594
diff changeset
   297
  
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 387
diff changeset
   298
  var height = $dynano(parentobj).Height();
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 387
diff changeset
   299
  var width  = $dynano(parentobj).Width();
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 387
diff changeset
   300
  var left   = $dynano(parentobj).Left();
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 387
diff changeset
   301
  var top    = $dynano(parentobj).Top();
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   302
  var left_pos = left + width ;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   303
  var top_pos = height + top;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   304
  var div = document.createElement('div');
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   305
  div.style.position = 'absolute';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   306
  div.style.top = top_pos + 'px';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   307
  div.className = 'question-box';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   308
  div.style.margin = '1px 0 0 2px';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   309
  var vtmp = 'input_' + Math.floor(Math.random() * 1000000);
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   310
  var regex = new RegExp('\"', 'g');
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   311
  var submit_target = ( typeof(url_string) == 'object' ) ? ( toJSONString(url_string) ).replace(regex, '\'') : 'unescape(\'' + escape(url_string) + '\')';
909
94c1ff984286 Finished core of log display interface including filter management. There is still a bit of a to-do list, especially regarding rollbacks and reuploads.
Dan
parents: 875
diff changeset
   312
  var onclick = 'paginator_submit(this, '+num_pages+', '+perpage+', '+additive+', '+submit_target+'); return false;';
387
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 359
diff changeset
   313
  div.innerHTML = $lang.get('paginate_lbl_goto_page') + '<br /><input type="text" size="2" style="padding: 1px; font-size: 8pt;" value="'+(parseInt(this_page)+1)+'" id="'+vtmp+'" />&emsp;<a href="#" onclick="'+onclick+'" style="font-size: 14pt; text-decoration: none;">&raquo;</a>&emsp;<a href="#" onclick="var _pn = this.parentNode; setTimeout(function() { _pn.parentNode.removeChild(_pn); }, 2000); fly_out_top(this.parentNode, false, true); return false;" style="font-size: 14pt; text-decoration: none;">&times;</a>';
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   314
  
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   315
  var body = document.getElementsByTagName('body')[0];
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   316
  domObjChangeOpac(0, div);
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   317
  
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   318
  body.appendChild(div);
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   319
  
359
e0787bb6285b Implemented IP logging for comments and registration
Dan
parents: 98
diff changeset
   320
  document.getElementById(vtmp).onkeypress = function(e)
e0787bb6285b Implemented IP logging for comments and registration
Dan
parents: 98
diff changeset
   321
    {
e0787bb6285b Implemented IP logging for comments and registration
Dan
parents: 98
diff changeset
   322
      if ( e.keyCode == 13 )
e0787bb6285b Implemented IP logging for comments and registration
Dan
parents: 98
diff changeset
   323
        this.nextSibling.nextSibling.onclick();
e0787bb6285b Implemented IP logging for comments and registration
Dan
parents: 98
diff changeset
   324
    };
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   325
  document.getElementById(vtmp).focus();
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   326
  
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   327
  // fade the div
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   328
  /*
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   329
  if(!div.id) div.id = 'autofade_'+Math.floor(Math.random() * 100000);
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   330
  var from = '#33FF33';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   331
  Fat.fade_element(div.id,30,2000,from,Fat.get_bgcolor(div.id));
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   332
  */
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   333
  
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   334
  fly_in_bottom(div, false, true);
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   335
  
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 387
diff changeset
   336
  var divh = $dynano(div).Width();
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   337
  left_pos = left_pos - divh;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   338
  div.style.left = left_pos + 'px';
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   339
}
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   340
909
94c1ff984286 Finished core of log display interface including filter management. There is still a bit of a to-do list, especially regarding rollbacks and reuploads.
Dan
parents: 875
diff changeset
   341
window.paginator_submit = function(obj, max, perpage, additive, formatstring)
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   342
{
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   343
  var userinput = obj.previousSibling.previousSibling.value;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   344
  userinput = parseInt(userinput);
909
94c1ff984286 Finished core of log display interface including filter management. There is still a bit of a to-do list, especially regarding rollbacks and reuploads.
Dan
parents: 875
diff changeset
   345
  var offset = (( userinput - 1 ) * perpage) + additive;
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   346
  if ( userinput > max || isNaN(userinput) || userinput < 1 )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   347
  {
875
0c3dd4c166c0 Some fixes to paginator (pagination control code moved to separate function)
Dan
parents: 789
diff changeset
   348
    load_component(['messagebox', 'fadefilter', 'flyin']);
550
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 420
diff changeset
   349
    new MessageBox(MB_OK|MB_ICONSTOP, $lang.get('paginate_err_bad_page_title'), $lang.get('paginate_err_bad_page_body', { max: max }));
85
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   350
    return false;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   351
  }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   352
  if ( typeof(formatstring) == 'object' )
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   353
  {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   354
    fly_out_top(obj.parentNode, false, true);
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   355
    jspaginator_goto(formatstring.random_id, ( offset / perpage ));
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   356
  }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   357
  else
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   358
  {
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   359
    var url = sprintf(formatstring, String(offset));
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   360
    fly_out_top(obj.parentNode, false, true);
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   361
    window.location = url;
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   362
  }
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   363
}
7c68a18a27be AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
diff changeset
   364
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   365
// This code is in the public domain. Feel free to link back to http://jan.moesen.nu/
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   366
function sprintf()
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   367
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   368
  if (!arguments || arguments.length < 1 || !RegExp)
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   369
  {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   370
    return;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   371
  }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   372
  var str = arguments[0];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   373
  var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   374
  var a = b = [], numSubstitutions = 0, numMatches = 0;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   375
  while (a = re.exec(str))
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   376
  {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   377
    var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   378
    var pPrecision = a[5], pType = a[6], rightPart = a[7];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   379
    
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   380
    //alert(a + '\n' + [a[0], leftpart, pPad, pJustify, pMinLength, pPrecision);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   381
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   382
    numMatches++;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   383
    if (pType == '%')
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   384
    {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   385
      subst = '%';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   386
    }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   387
    else
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   388
    {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   389
      numSubstitutions++;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   390
      if (numSubstitutions >= arguments.length)
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   391
      {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   392
        alert('Error! Not enough function arguments (' + (arguments.length - 1) + ', excluding the string)\nfor the number of substitution parameters in string (' + numSubstitutions + ' so far).');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   393
      }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   394
      var param = arguments[numSubstitutions];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   395
      var pad = '';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   396
             if (pPad && pPad.substr(0,1) == "'") pad = leftpart.substr(1,1);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   397
        else if (pPad) pad = pPad;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   398
      var justifyRight = true;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   399
             if (pJustify && pJustify === "-") justifyRight = false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   400
      var minLength = -1;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   401
             if (pMinLength) minLength = parseInt(pMinLength);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   402
      var precision = -1;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   403
             if (pPrecision && pType == 'f') precision = parseInt(pPrecision.substring(1));
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   404
      var subst = param;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   405
             if (pType == 'b') subst = parseInt(param).toString(2);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   406
        else if (pType == 'c') subst = String.fromCharCode(parseInt(param));
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   407
        else if (pType == 'd') subst = parseInt(param) ? parseInt(param) : 0;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   408
        else if (pType == 'u') subst = Math.abs(param);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   409
        else if (pType == 'f') subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision): parseFloat(param);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   410
        else if (pType == 'o') subst = parseInt(param).toString(8);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   411
        else if (pType == 's') subst = param;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   412
        else if (pType == 'x') subst = ('' + parseInt(param).toString(16)).toLowerCase();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   413
        else if (pType == 'X') subst = ('' + parseInt(param).toString(16)).toUpperCase();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   414
    }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   415
    str = leftpart + subst + rightPart;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   416
  }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   417
  return str;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 550
diff changeset
   418
}