decir/js/admin/reorder.js
author Dan
Tue, 13 Nov 2007 23:33:14 -0500
changeset 9 6d9655e02026
parent 8 850e1b1209a9
child 10 36bc382ed459
permissions -rw-r--r--
Removed all dragger debugging info and started on the form for forum/category deletion
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
     1
var reorder_state = {
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
     2
  _: false,
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
     3
  type: false,
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
     4
  id: false,
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
     5
  obj: false,
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
     6
  over: false
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
     7
}
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
     8
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
     9
function decir_admin_dragforum_start(e)
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    10
{
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    11
  document.onmouseup = decir_admin_dragforum_close;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    12
  
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    13
  reorder_state.obj = this;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    14
  reorder_state.over = this;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    15
  
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    16
  reorder_state._ = true;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    17
  if ( $dynano(this).hasClass('decir_forum') )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    18
  {
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    19
    reorder_state.type = 'forum';
9
6d9655e02026 Removed all dragger debugging info and started on the form for forum/category deletion
Dan
parents: 8
diff changeset
    20
    this.style.borderBottom = '5px solid #000000';
7
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    21
  }
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    22
  
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    23
  document.onmousemove = decir_admin_dragforum_onmouse;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    24
  
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    25
  return false;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    26
}
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    27
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    28
function decir_admin_dragforum_onmouse(e)
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    29
{
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    30
  setMousePos(e);
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    31
  
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    32
  // Determine threshold for moving the target
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    33
  var nodes = reorder_state.obj.parentNode.parentNode.childNodes;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    34
  var threshold = new Object();
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    35
  for ( var i = 0; i < nodes.length; i++ )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    36
  {
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    37
    var node = nodes[i];
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    38
    if ( node.tagName == 'TR' && node.DecirForumID )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    39
    {
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    40
      // This is a row with a forum in it - add to the threshold list.
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    41
      var t = $(node).Top();
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    42
      var h = $(node).Height();
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    43
      threshold[node.DecirForumID] = t + ( h / 2 );
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    44
    }
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    45
  }
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    46
  // Move the bar if mouseY is lower than the threshold for the next cell up or higher (lower on screen) than the next cell down.
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    47
  var moveme = false;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    48
  var current_threshold = threshold[ reorder_state.over.parentNode.DecirForumID ];
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    49
  var next_threshold = threshold[ parseInt(reorder_state.over.parentNode.DecirForumID) + 1 ];
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    50
  if ( !next_threshold )
8
850e1b1209a9 Fix a few typos in reorder.js
Dan
parents: 7
diff changeset
    51
    next_threshold = -1;
850e1b1209a9 Fix a few typos in reorder.js
Dan
parents: 7
diff changeset
    52
  // window.console.debug('current ', current_threshold, ' next ', next_threshold);
7
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    53
  if ( mouseY < current_threshold )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    54
  {
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    55
    var prev_tr = reorder_state.over.parentNode.previousSibling;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    56
    if ( !prev_tr )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    57
      // already at the top
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    58
      return false;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    59
    // find the prev_td
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    60
    var i = 0;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    61
    var prev_td;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    62
    while ( true )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    63
    {
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    64
      prev_td = prev_tr.childNodes[i];
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    65
      if ( !prev_td )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    66
        continue;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    67
      if ( prev_td.tagName == 'TD' || i == 10000 )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    68
        break;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    69
      i++;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    70
    }
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    71
    if ( prev_td.tagName != 'TD' )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    72
      return false;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    73
    reorder_state.over.style.borderBottom = null;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    74
    reorder_state.over = prev_td;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    75
    reorder_state.over.style.borderBottom = '5px solid #000000';
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    76
  }
8
850e1b1209a9 Fix a few typos in reorder.js
Dan
parents: 7
diff changeset
    77
  else if ( mouseY > next_threshold && next_threshold > -1 )
7
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    78
  {
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    79
    var next_tr = reorder_state.over.parentNode.nextSibling;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    80
    if ( !next_tr )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    81
      // already at the top
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    82
      return false;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    83
    // find the next_td
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    84
    var i = 0;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    85
    var next_td;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    86
    while ( true )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    87
    {
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    88
      next_td = next_tr.childNodes[i];
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    89
      if ( i >= 100 )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    90
        break;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    91
      if ( !next_td )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    92
      {
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    93
        i++;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    94
        continue;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    95
      }
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    96
      if ( next_td.tagName == 'TD' || i == 100 )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    97
        break;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    98
      i++;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
    99
    }
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   100
    if ( !next_td )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   101
      return false;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   102
    if ( next_td.tagName != 'TD' )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   103
      return false;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   104
    reorder_state.over.style.borderBottom = null;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   105
    reorder_state.over = next_td;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   106
    reorder_state.over.style.borderBottom = '5px solid #000000';
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   107
  }
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   108
}
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   109
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   110
function decir_admin_dragforum_reset(e)
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   111
{
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   112
  var cls = ( reorder_state.type == 'forum' ? 'decir_forum' : 'decir_category' ); 
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   113
  var forums = getElementsByClassName(document, '*', cls);
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   114
  for ( var i = 0; i < forums.length; i++ )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   115
  {
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   116
    forums[i].onmousedown = decir_admin_dragforum_start;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   117
    forums[i].style.cursor = 'move';
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   118
    forums[i].style.borderBottom = null;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   119
  }
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   120
}
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   121
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   122
function decir_admin_dragforum_close(e)
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   123
{
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   124
  document.onmousemove = function(e) {
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   125
    setMousePos(e);
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   126
  }
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   127
  document.onmouseup = function() {};
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   128
  decir_admin_dragforum_reset(e);
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   129
  
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   130
  reorder_state._ = false;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   131
  
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   132
  // Move the row (or rather copy and delete)
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   133
  var newnode = reorder_state.obj.parentNode.cloneNode(true);
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   134
  insertAfter(reorder_state.obj.parentNode.parentNode, newnode, reorder_state.over.parentNode);
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   135
  reorder_state.obj.parentNode.parentNode.removeChild(reorder_state.obj.parentNode);
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   136
  
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   137
  // for some reason this needs to be called again in gecko (to reinit some values)
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   138
  decir_admin_dragforum_onload();
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   139
  
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   140
  var idlist = [];
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   141
  var forums = getElementsByClassName(document, '*', 'decir_forum');
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   142
  for ( var i = 0; i < forums.length; i++ )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   143
  {
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   144
    idlist.push(forums[i].parentNode.DecirForumID);
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   145
  }
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   146
  idlist = implode(',', idlist);
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   147
  $('forum_order').object.value = idlist;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   148
}
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   149
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   150
var decir_admin_dragforum_onload = function(e)
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   151
{
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   152
  var forums = getElementsByClassName(document, '*', 'decir_forum');
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   153
  for ( var i = 0; i < forums.length; i++ )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   154
  {
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   155
    forums[i].onmousedown = decir_admin_dragforum_start;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   156
    forums[i].style.cursor = 'move';
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   157
    forums[i].parentNode.DecirForumID = forums[i].firstChild.value;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   158
    forums[i].title = 'Click and drag to re-order this forum';
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   159
  }
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   160
  var forums = getElementsByClassName(document, '*', 'decir_category');
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   161
  for ( var i = 0; i < forums.length; i++ )
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   162
  {
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   163
    //forums[i].onmousedown = decir_admin_dragforum_start;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   164
    //forums[i].style.cursor = 'move';
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   165
    //forums[i].parentNode.DecirForumID = forums[i].firstChild.value;
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   166
  }
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   167
}
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   168
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   169
addOnloadHook(decir_admin_dragforum_onload);
37387f84fe25 Add edit functionality to forum management and implemented a sick drag-and-drop reordering system for forums
Dan
parents:
diff changeset
   170