includes/clientside/static/rank-manager.js
author Dan
Sat, 19 Jul 2008 20:47:00 -0400
changeset 645 24f2fa13a2a0
parent 628 ab6f55abb17e
child 651 ce9d78d7251d
permissions -rw-r--r--
Fixed autofill ignoring existing ID for text box parent node. Note that autofill is still in a nonworking state.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
     1
/**
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
     2
 * Creates a control that can be used to edit a rank.
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
     3
 */
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
     4
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
     5
var RankEditorControl = function(rankdata)
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
     6
{
628
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
     7
  this.rankdata = ( typeof(rankdata) == 'object' ) ? rankdata : {};
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
     8
  
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
     9
  // have the browser parse CSS for us and use an anchor to be as close
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    10
  // as possible in calculating CSS
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    11
  
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    12
  // this is kind of a hack as it relies on setAttribute/getAttribute in
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    13
  // order to obtain stringified versions of CSS data
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    14
  var cssobj = document.createElement('a');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    15
  cssobj.setAttribute('style', this.rankdata.rank_style);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    16
  
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    17
  this.style_sim_obj = cssobj;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    18
  
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    19
  // figure out if we're editing or creating
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    20
  this.editing = ( typeof(this.rankdata.rank_id) == 'number' );
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    21
  
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    22
  this.render = function()
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    23
  {
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    24
    var editor = document.createElement('div');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    25
    editor.className = 'tblholder';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    26
    // stash this editor instance in the parent div for later function calls
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    27
    editor.editor = this;
628
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
    28
    this.wrapperdiv = editor;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
    29
    editor.style.width = '100%';
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    30
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    31
    // tables suck.
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    32
    var table = document.createElement('table');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    33
    table.setAttribute('cellspacing', '1');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    34
    table.setAttribute('cellpadding', '4');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    35
    table.setAttribute('width', '100%');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    36
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    37
    // heading: "Edit rank: foo" or "Create a new rank"
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    38
    var tr_head = document.createElement('tr');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    39
    var th_head = document.createElement('th');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    40
    th_head.setAttribute('colspan', '2');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    41
    if ( this.editing )
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    42
    {
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    43
      var th_head_string = 'acpur_th_edit_rank';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    44
      var th_head_data = { rank_title: $lang.get(this.rankdata.rank_title) };
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    45
    }
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    46
    else
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    47
    {
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    48
      var th_head_string = 'acpur_th_create_rank';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    49
      var th_head_data = { };
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    50
    }
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    51
    th_head.appendChild(document.createTextNode($lang.get(th_head_string, th_head_data)));
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    52
    tr_head.appendChild(th_head);
628
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
    53
    this.th_head = th_head;
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    54
    table.appendChild(tr_head);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    55
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    56
    // row: rank title
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    57
    var tr_title = document.createElement('tr');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    58
    var td_title_l = document.createElement('td');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    59
    var td_title_f = document.createElement('td');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    60
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    61
    td_title_l.className = td_title_f.className = 'row1';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    62
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    63
    td_title_l.appendChild(document.createTextNode($lang.get('acpur_field_rank_title')));
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    64
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    65
    // field: rank title
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    66
    var f_rank_title = document.createElement('input');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    67
    f_rank_title.type = 'text';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    68
    f_rank_title.size = '30';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    69
    f_rank_title.value = ( this.editing ) ? this.rankdata.rank_title : '';
628
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
    70
    f_rank_title.editor = this;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
    71
    f_rank_title.onkeyup = function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
    72
    {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
    73
      this.editor.renderPreview();
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
    74
    }
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    75
    this.f_rank_title = f_rank_title;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    76
    td_title_f.appendChild(f_rank_title);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    77
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    78
    tr_title.appendChild(td_title_l);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    79
    tr_title.appendChild(td_title_f);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    80
    table.appendChild(tr_title);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    81
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    82
    // row: basic style options
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    83
    var tr_basic = document.createElement('tr');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    84
    var td_basic_l = document.createElement('td');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    85
    var td_basic_f = document.createElement('td');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    86
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    87
    td_basic_l.className = td_basic_f.className = 'row2';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    88
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    89
    td_basic_l.appendChild(document.createTextNode($lang.get('acpur_field_style_basic')));
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    90
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    91
    // fieldset: basic style options
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    92
    // field: bold
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    93
    var l_basic_bold = document.createElement('label');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    94
    var f_basic_bold = document.createElement('input');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    95
    f_basic_bold.type = 'checkbox';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    96
    f_basic_bold.checked = ( this.style_sim_obj.style.fontWeight == 'bold' ) ? true : false;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    97
    f_basic_bold.editor = this;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    98
    f_basic_bold.onclick = function()
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
    99
    {
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   100
      this.editor.style_sim_obj.style.fontWeight = ( this.checked ) ? 'bold' : null;
628
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   101
      this.editor.renderPreview();
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   102
    }
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   103
    l_basic_bold.style.fontWeight = 'bold';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   104
    l_basic_bold.appendChild(f_basic_bold);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   105
    l_basic_bold.appendChild(document.createTextNode(' '));
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   106
    l_basic_bold.appendChild(document.createTextNode($lang.get('acpur_field_style_basic_bold')));
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   107
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   108
    // field: italic
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   109
    var l_basic_italic = document.createElement('label');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   110
    var f_basic_italic = document.createElement('input');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   111
    f_basic_italic.type = 'checkbox';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   112
    f_basic_italic.checked = ( this.style_sim_obj.style.fontStyle == 'italic' ) ? true : false;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   113
    f_basic_italic.editor = this;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   114
    f_basic_italic.onclick = function()
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   115
    {
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   116
      this.editor.style_sim_obj.style.fontStyle = ( this.checked ) ? 'italic' : null;
628
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   117
      this.editor.renderPreview();
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   118
    }
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   119
    l_basic_italic.style.fontStyle = 'italic';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   120
    l_basic_italic.appendChild(f_basic_italic);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   121
    l_basic_italic.appendChild(document.createTextNode(' '));
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   122
    l_basic_italic.appendChild(document.createTextNode($lang.get('acpur_field_style_basic_italic')));
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   123
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   124
    // field: underline
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   125
    var l_basic_underline = document.createElement('label');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   126
    var f_basic_underline = document.createElement('input');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   127
    f_basic_underline.type = 'checkbox';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   128
    f_basic_underline.checked = ( this.style_sim_obj.style.textDecoration == 'underline' ) ? true : false;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   129
    f_basic_underline.editor = this;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   130
    f_basic_underline.onclick = function()
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   131
    {
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   132
      this.editor.style_sim_obj.style.textDecoration = ( this.checked ) ? 'underline' : null;
628
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   133
      this.editor.renderPreview();
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   134
    }
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   135
    l_basic_underline.style.textDecoration = 'underline';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   136
    l_basic_underline.appendChild(f_basic_underline);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   137
    l_basic_underline.appendChild(document.createTextNode(' '));
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   138
    l_basic_underline.appendChild(document.createTextNode($lang.get('acpur_field_style_basic_underline')));
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   139
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   140
    // finish up formatting row#1
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   141
    td_basic_f.appendChild(l_basic_bold);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   142
    td_basic_f.appendChild(document.createTextNode(' '));
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   143
    td_basic_f.appendChild(l_basic_italic);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   144
    td_basic_f.appendChild(document.createTextNode(' '));
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   145
    td_basic_f.appendChild(l_basic_underline);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   146
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   147
    tr_basic.appendChild(td_basic_l);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   148
    tr_basic.appendChild(td_basic_f);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   149
    table.appendChild(tr_basic);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   150
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   151
    // row: rank color
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   152
    var tr_color = document.createElement('tr');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   153
    var td_color_l = document.createElement('td');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   154
    var td_color_f = document.createElement('td');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   155
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   156
    td_color_l.className = td_color_f.className = 'row1';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   157
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   158
    td_color_l.appendChild(document.createTextNode($lang.get('acpur_field_style_color')));
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   159
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   160
    // field: rank color
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   161
    var f_rank_color = document.createElement('input');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   162
    f_rank_color.type = 'text';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   163
    f_rank_color.size = '7';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   164
    f_rank_color.value = ( this.editing ) ? this.rgb2hex(this.style_sim_obj.style.color) : '';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   165
    f_rank_color.style.backgroundColor = this.style_sim_obj.style.color;
628
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   166
    f_rank_color.editor = this;
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   167
    this.f_rank_color = f_rank_color;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   168
    f_rank_color.onkeyup = function(e)
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   169
    {
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   170
      if ( !e.keyCode )
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   171
        e = window.event;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   172
      if ( !e )
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   173
        return false;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   174
      var chr = (String.fromCharCode(e.keyCode)).toLowerCase();
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   175
      this.value = this.value.replace(/[^a-fA-F0-9]/g, '');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   176
      if ( this.value.length > 6 )
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   177
      {
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   178
        this.value = this.value.substr(0, 6);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   179
      }
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   180
      if ( this.value.length == 6 || this.value.length == 3 )
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   181
      {
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   182
        this.style.backgroundColor = '#' + this.value;
628
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   183
        this.editor.style_sim_obj.style.color = '#' + this.value;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   184
        this.style.color = '#' + this.editor.determineLightness(this.value);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   185
        this.editor.renderPreview();
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   186
      }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   187
      else if ( this.value.length == 0 )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   188
      {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   189
        this.style.backgroundColor = null;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   190
        this.editor.style_sim_obj.style.color = null;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   191
        this.editor.renderPreview();
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   192
      }
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   193
    }
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   194
    td_color_f.appendChild(f_rank_color);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   195
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   196
    tr_color.appendChild(td_color_l);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   197
    tr_color.appendChild(td_color_f);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   198
    table.appendChild(tr_color);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   199
    
628
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   200
    // "field": preview
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   201
    var tr_preview = document.createElement('tr');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   202
    var td_preview_l = document.createElement('td');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   203
    td_preview_l.className = 'row2';
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   204
    td_preview_l.appendChild(document.createTextNode($lang.get('acpur_field_preview')));
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   205
    tr_preview.appendChild(td_preview_l);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   206
    
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   207
    var td_preview_f = document.createElement('td');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   208
    td_preview_f.className = 'row2';
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   209
    var div_preview = document.createElement('a');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   210
    this.preview_div = div_preview;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   211
    div_preview.style.fontSize = 'x-large';
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   212
    div_preview.appendChild(document.createTextNode(''));
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   213
    div_preview.firstChild.nodeValue = ( this.editing ) ? this.rankdata.rank_title : '';
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   214
    td_preview_f.appendChild(div_preview);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   215
    tr_preview.appendChild(td_preview_f);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   216
    
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   217
    table.appendChild(tr_preview);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   218
    
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   219
    // submit button
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   220
    var tr_submit = document.createElement('tr');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   221
    var th_submit = document.createElement('th');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   222
    th_submit.className = 'subhead';
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   223
    th_submit.setAttribute('colspan', '2');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   224
    var btn_submit = document.createElement('input');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   225
    btn_submit.type = 'submit';
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   226
    btn_submit.value = ( this.editing ) ? $lang.get('acpur_btn_save') : $lang.get('acpur_btn_create_submit');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   227
    btn_submit.editor = this;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   228
    btn_submit.style.fontWeight = 'bold';
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   229
    btn_submit.onclick = function(e)
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   230
    {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   231
      this.editor.submitEvent(e);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   232
    }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   233
    this.btn_submit = btn_submit;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   234
    th_submit.appendChild(btn_submit);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   235
    
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   236
    // delete button
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   237
    if ( this.editing )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   238
    {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   239
      var btn_delete = document.createElement('input');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   240
      btn_delete.type = 'button';
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   241
      btn_delete.value = $lang.get('acpur_btn_delete');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   242
      btn_delete.editor = this;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   243
      btn_delete.onclick = function(e)
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   244
      {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   245
        this.editor.deleteEvent(e);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   246
      }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   247
      th_submit.appendChild(document.createTextNode(' '));
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   248
      th_submit.appendChild(btn_delete);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   249
    }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   250
    
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   251
    tr_submit.appendChild(th_submit);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   252
    
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   253
    table.appendChild(tr_submit);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   254
    
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   255
    // render preview
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   256
    this.renderPreview();
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   257
    
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   258
    // finalize the editor table
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   259
    editor.appendChild(table);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   260
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   261
    // stash rendered editor
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   262
    this.editordiv = editor;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   263
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   264
    // send output
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   265
    return editor;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   266
  }
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   267
  
628
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   268
  /**
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   269
   * Takes the existing editor div and transforms the necessary elements so that it goes from "create" mode to "edit" mode
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   270
   * @param object Edit data - same format as the rankdata parameter to the constructor, but we should only need rank_id
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   271
   */
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   272
  
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   273
  this.transformToEditor = function(rankdata)
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   274
  {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   275
    // we need a rank ID
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   276
    if ( typeof(rankdata.rank_id) != 'number' )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   277
      return false;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   278
    
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   279
    if ( this.editing )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   280
      return false;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   281
    
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   282
    this.editing = true;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   283
    
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   284
    this.rankdata = rankdata;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   285
    this.rankdata.rank_title = this.f_rank_title.value;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   286
    this.rankdata.rank_style = this.getCSS();
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   287
    
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   288
    // transform various controls
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   289
    this.th_head.firstChild.nodeValue = $lang.get('acpur_th_edit_rank', {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   290
        rank_title: $lang.get(this.rankdata.rank_title)
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   291
      });
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   292
    this.btn_submit.value = $lang.get('acpur_btn_save');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   293
    
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   294
    // add the delete button
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   295
    var th_submit = this.btn_submit.parentNode;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   296
    
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   297
    var btn_delete = document.createElement('input');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   298
    btn_delete.type = 'button';
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   299
    btn_delete.value = $lang.get('acpur_btn_delete');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   300
    btn_delete.editor = this;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   301
    btn_delete.onclick = function(e)
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   302
    {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   303
      this.editor.deleteEvent(e);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   304
    }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   305
    th_submit.appendChild(document.createTextNode(' '));
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   306
    th_submit.appendChild(btn_delete);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   307
    
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   308
    return true;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   309
  }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   310
  
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   311
  /**
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   312
   * Takes a hex color, averages the three channels, and returns either 'ffffff' or '000000' depending on the luminosity of the color.
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   313
   * @param string
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   314
   * @return string
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   315
   */
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   316
  
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   317
  this.determineLightness = function(hexval)
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   318
  {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   319
    var rgb = this.hex2rgb(hexval);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   320
    var lumin = ( rgb[0] + rgb[1] + rgb[2] ) / 3;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   321
    return ( lumin > 60 ) ? '000000' : 'ffffff';
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   322
  }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   323
  
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   324
  this.getJSONDataset = function()
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   325
  {
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   326
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   327
  }
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   328
  
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   329
  this.getCSS = function()
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   330
  {
628
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   331
    return this.style_sim_obj.getAttribute('style');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   332
  }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   333
  
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   334
  this.renderPreview = function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   335
  {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   336
    if ( !this.preview_div )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   337
      return false;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   338
    var color = ( this.style_sim_obj.style.color ) ? '#' + this.rgb2hex(this.style_sim_obj.style.color) : null;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   339
    this.preview_div.style.color = color;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   340
    this.preview_div.style.fontWeight = this.style_sim_obj.style.fontWeight;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   341
    this.preview_div.style.fontStyle = this.style_sim_obj.style.fontStyle;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   342
    this.preview_div.style.textDecoration = this.style_sim_obj.style.textDecoration;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   343
    this.preview_div.firstChild.nodeValue = $lang.get(this.f_rank_title.value);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   344
  }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   345
  
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   346
  this.submitEvent = function(e)
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   347
  {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   348
    if ( this.onsubmit )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   349
    {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   350
      this.onsubmit(e);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   351
    }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   352
    else
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   353
    {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   354
      window.console.error('RankEditorControl: no onsubmit event specified');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   355
    }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   356
  }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   357
  
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   358
  this.deleteEvent = function(e)
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   359
  {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   360
    if ( this.ondelete )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   361
    {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   362
      this.ondelete(e);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   363
    }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   364
    else
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   365
    {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   366
      window.console.error('RankEditorControl: no ondelete event specified');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   367
    }
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   368
  }
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   369
  
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   370
  /**
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   371
   * Converts a parenthetical color specification (rgb(x, y, z)) to hex form (xxyyzz)
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   372
   * @param string
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   373
   * @return string
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   374
   */
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   375
  
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   376
  this.rgb2hex = function(rgb)
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   377
  {
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   378
    var p = rgb.match(/^rgb\(([0-9]+), ([0-9]+), ([0-9]+)\)$/);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   379
    if ( !p )
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   380
      return rgb.replace(/^#/, '');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   381
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   382
    var r = parseInt(p[1]).toString(16), g = parseInt(p[2]).toString(16), b = parseInt(p[3]).toString(16);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   383
    if ( r.length < 2 )
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   384
      r = '0' + r;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   385
    if ( g.length < 2 )
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   386
      g = '0' + g;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   387
    if ( b.length < 2 )
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   388
      b = '0' + b;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   389
    
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   390
    return r + g + b;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   391
  }
628
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   392
  
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   393
  /**
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   394
   * Get red, green, and blue values for the given hex color
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   395
   * @param string
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   396
   * @return array (numbered, e.g. not an object
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   397
   */
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   398
  
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   399
  this.hex2rgb = function(hex)
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   400
  {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   401
    hex = hex.replace(/^#/, '');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   402
    if ( hex.length != 3 && hex.length != 6 )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   403
    {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   404
      return hex;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   405
    }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   406
    if ( hex.length == 3 )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   407
    {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   408
      // is there a better way to do this?
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   409
      hex = hex.charAt(0) + hex.charAt(0) + hex.charAt(1) + hex.charAt(1) + hex.charAt(2) + hex.charAt(2);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   410
    }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   411
    hex = [ hex.substr(0, 2), hex.substr(2, 2), hex.substr(4, 2) ];
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   412
    var red = parseInt(hex[0], 16);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   413
    var green = parseInt(hex[1], 16);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   414
    var blue = parseInt(hex[2], 16);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   415
    return [red, green, blue];
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   416
  }
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   417
}
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   418
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   419
/**
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   420
 * Perform request for editable rank data and draw editor
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   421
 */
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   422
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   423
function ajaxInitRankEdit(rank_id)
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   424
{
628
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   425
  load_component('messagebox');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   426
  var json_packet = {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   427
    mode: 'get_rank',
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   428
    rank_id: rank_id
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   429
  };
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   430
  json_packet = ajaxEscape(toJSONString(json_packet));
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   431
  ajaxPost(makeUrlNS('Admin', 'UserRanks/action.json'), 'r=' + json_packet, function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   432
    {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   433
      if ( ajax.readyState == 4 && ajax.status == 200 )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   434
      {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   435
        var response = String(ajax.responseText + '');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   436
        if ( response.substr(0, 1) != '{' )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   437
        {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   438
          handle_invalid_json(ajax.responseText);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   439
          return false;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   440
        }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   441
        try
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   442
        {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   443
          var response = parseJSON(ajax.responseText);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   444
        }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   445
        catch(e)
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   446
        {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   447
          handle_invalid_json(ajax.responseText);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   448
        }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   449
        var editor = new RankEditorControl(response);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   450
        editor.onsubmit = ajaxRankEditHandleSaveExisting;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   451
        editor.ondelete = ajaxRankEditHandleDelete;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   452
        var container = document.getElementById('admin_ranks_container_right');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   453
        container.innerHTML = '';
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   454
        container.appendChild(editor.render());
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   455
      }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   456
    }, true);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   457
}
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   458
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   459
function ajaxInitRankCreate()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   460
{
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   461
  load_component('messagebox');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   462
  var editor = new RankEditorControl();
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   463
  editor.onsubmit = ajaxRankEditHandleSaveNew;
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   464
  var container = document.getElementById('admin_ranks_container_right');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   465
  container.innerHTML = '';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   466
  container.appendChild(editor.render());
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents:
diff changeset
   467
}
628
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   468
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   469
function ajaxRankEditHandleSave(editor, switch_new)
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   470
{
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   471
  var whitey = whiteOutElement(editor.wrapperdiv);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   472
  
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   473
  // pack it up, ...
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   474
  var json_packet = {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   475
    mode: ( switch_new ) ? 'create_rank' : 'save_rank',
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   476
    rank_title: editor.f_rank_title.value,
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   477
    rank_style: editor.getCSS()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   478
  }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   479
  if ( !switch_new )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   480
  {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   481
    json_packet.rank_id = editor.rankdata.rank_id;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   482
  }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   483
  /// ... pack it in
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   484
  var json_packet = ajaxEscape(toJSONString(json_packet));
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   485
  
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   486
  ajaxPost(makeUrlNS('Admin', 'UserRanks/action.json'), 'r=' + json_packet, function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   487
    {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   488
      if ( ajax.readyState == 4 && ajax.status == 200 )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   489
      {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   490
        var response = String(ajax.responseText + '');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   491
        if ( response.substr(0, 1) != '{' )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   492
        {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   493
          handle_invalid_json(ajax.responseText);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   494
          return false;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   495
        }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   496
        try
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   497
        {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   498
          var response = parseJSON(ajax.responseText);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   499
        }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   500
        catch(e)
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   501
        {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   502
          handle_invalid_json(ajax.responseText);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   503
        }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   504
        if ( response.mode == 'success' )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   505
        {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   506
          whiteOutReportSuccess(whitey);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   507
          if ( switch_new )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   508
          {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   509
            //
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   510
            // we have a few more things to do with a newly created rank.
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   511
            //
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   512
            
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   513
            // 1. transform editor
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   514
            editor.transformToEditor(response);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   515
            editor.onsubmit = ajaxRankEditHandleSaveExisting;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   516
            editor.ondelete = ajaxRankEditHandleDelete;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   517
            
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   518
            // 2. append the new rank to the list
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   519
            var create_link = document.getElementById('rankadmin_createlink');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   520
            if ( create_link )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   521
            {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   522
              var parent = create_link.parentNode;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   523
              var edit_link = document.createElement('a');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   524
              edit_link.href = '#rank_edit:' + response.rank_id;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   525
              edit_link.className = 'rankadmin-editlink';
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   526
              edit_link.setAttribute('style', editor.getCSS());
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   527
              edit_link.id = 'rankadmin_editlink_' + response.rank_id;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   528
              edit_link.rank_id = response.rank_id;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   529
              edit_link.appendChild(document.createTextNode($lang.get(editor.f_rank_title.value)));
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   530
              parent.insertBefore(edit_link, create_link);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   531
              edit_link.onclick = function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   532
              {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   533
                ajaxInitRankEdit(this.rank_id);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   534
              }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   535
            }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   536
          }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   537
          else
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   538
          {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   539
            // update the rank title on the left
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   540
            var edit_link = document.getElementById('rankadmin_editlink_' + editor.rankdata.rank_id);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   541
            if ( edit_link )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   542
            {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   543
              edit_link.firstChild.nodeValue = $lang.get(editor.f_rank_title.value);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   544
              edit_link.setAttribute('style', editor.getCSS());
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   545
            }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   546
          }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   547
        }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   548
        else
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   549
        {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   550
          whitey.parentNode.removeChild(whitey);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   551
          miniPromptMessage({
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   552
              title: $lang.get('acpur_err_save_failed_title'),
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   553
              message: response.error,
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   554
              buttons: [
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   555
                {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   556
                  text: $lang.get('etc_ok'),
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   557
                  color: 'red',
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   558
                  style: {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   559
                    fontWeight: 'bold'
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   560
                  },
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   561
                  onclick: function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   562
                  {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   563
                    miniPromptDestroy(this);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   564
                  }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   565
                }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   566
              ]
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   567
          });
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   568
        }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   569
      }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   570
    }, true);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   571
}
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   572
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   573
var ajaxRankEditHandleSaveExisting = function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   574
{
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   575
  ajaxRankEditHandleSave(this, false);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   576
}
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   577
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   578
var ajaxRankEditHandleSaveNew = function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   579
{
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   580
  ajaxRankEditHandleSave(this, true);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   581
}
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   582
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   583
var ajaxRankEditHandleDelete = function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   584
{
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   585
  var mp = miniPromptMessage({
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   586
      title: $lang.get('acpur_msg_rank_delete_confirm_title'),
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   587
      message: $lang.get('acpur_msg_rank_delete_confirm_body'),
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   588
      buttons: [
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   589
        {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   590
          text: $lang.get('acpur_btn_delete'),
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   591
          color: 'red',
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   592
          style: {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   593
            fontWeight: 'bold'
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   594
          },
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   595
          onclick: function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   596
          {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   597
            var parent = miniPromptGetParent(this);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   598
            var editor = parent.editor;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   599
            setTimeout(function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   600
              {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   601
                ajaxRankEditDeleteConfirmed(editor);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   602
              }, 1000);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   603
            miniPromptDestroy(parent);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   604
          }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   605
        },
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   606
        {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   607
          text: $lang.get('etc_cancel'),
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   608
          onclick: function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   609
          {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   610
            miniPromptDestroy(this);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   611
          }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   612
        }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   613
      ]
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   614
    });
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   615
  console.debug(mp);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   616
  mp.editor = this;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   617
}
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   618
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   619
function ajaxRankEditDeleteConfirmed(editor)
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   620
{
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   621
  var whitey = whiteOutElement(editor.wrapperdiv);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   622
  
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   623
  load_component('SpryEffects');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   624
  
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   625
  var json_packet = {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   626
    mode: 'delete_rank',
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   627
    rank_id: editor.rankdata.rank_id
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   628
  };
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   629
  var rank_id = editor.rankdata.rank_id;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   630
  
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   631
  json_packet = ajaxEscape(toJSONString(json_packet));
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   632
  ajaxPost(makeUrlNS('Admin', 'UserRanks/action.json'), 'r=' + json_packet, function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   633
    {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   634
      if ( ajax.readyState == 4 && ajax.status == 200 )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   635
      {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   636
        var response = String(ajax.responseText + '');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   637
        if ( response.substr(0, 1) != '{' )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   638
        {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   639
          handle_invalid_json(ajax.responseText);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   640
          return false;
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   641
        }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   642
        try
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   643
        {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   644
          var response = parseJSON(ajax.responseText);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   645
        }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   646
        catch(e)
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   647
        {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   648
          handle_invalid_json(ajax.responseText);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   649
        }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   650
        if ( response.mode == 'success' )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   651
        {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   652
          // the deletion was successful, report success and kill off the editor
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   653
          whiteOutReportSuccess(whitey);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   654
          setTimeout(function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   655
            {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   656
              // nuke the rank title on the left
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   657
              var edit_link = document.getElementById('rankadmin_editlink_' + editor.rankdata.rank_id);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   658
              if ( edit_link )
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   659
              {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   660
                edit_link.parentNode.removeChild(edit_link);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   661
              }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   662
              // collapse and destroy the editor
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   663
              new Spry.Effect.Blind(editor.wrapperdiv, { duration: 500, finish: function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   664
                  {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   665
                    // when the animation finishes, nuke the whole thing
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   666
                    var container = document.getElementById('admin_ranks_container_right');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   667
                    container.innerHTML = $lang.get('acpur_msg_select_rank');
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   668
                  }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   669
                }).start();
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   670
            }, 1500);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   671
        }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   672
        else
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   673
        {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   674
          whitey.parentNode.removeChild(whitey);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   675
          miniPromptMessage({
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   676
              title: $lang.get('acpur_err_delete_failed_title'),
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   677
              message: response.error,
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   678
              buttons: [
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   679
                {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   680
                  text: $lang.get('etc_ok'),
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   681
                  color: 'red',
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   682
                  style: {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   683
                    fontWeight: 'bold'
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   684
                  },
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   685
                  onclick: function()
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   686
                  {
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   687
                    miniPromptDestroy(this);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   688
                  }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   689
                }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   690
              ]
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   691
          });
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   692
        }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   693
      }
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   694
    }, true);
ab6f55abb17e Rank editor is now in a working (beautiful) state. More intuitive than a Mac.
Dan
parents: 563
diff changeset
   695
}