includes/clientside/static/theme-manager.js
author Dan
Sat, 08 Mar 2008 12:13:23 -0500
changeset 495 00f5cd31217a
parent 465 fe8b8c9b54e8
child 651 ce9d78d7251d
permissions -rw-r--r--
Fixed undefined variable ($row['is_regex'] instead of $is_regex) in sessions.php
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
     1
function ajaxToggleSystemThemes()
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
     2
{
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
     3
  var theme_list = document.getElementById('theme_list_edit');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
     4
  var mode = ( theme_list.sys_shown ) ? 'hide' : 'show';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
     5
  for ( var i = 0; i < theme_list.childNodes.length; i++ )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
     6
  {
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
     7
    var child = theme_list.childNodes[i];
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
     8
    if ( child.tagName == 'DIV' )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
     9
    {
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    10
      if ( $(child).hasClass('themebutton_theme_system') )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    11
      {
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    12
        if ( $(child).hasClass('themebutton_theme_disabled') )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    13
        {
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    14
          $(child).rmClass('themebutton_theme_disabled')
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    15
        }
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    16
        if ( mode == 'show' )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    17
        {
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    18
          domObjChangeOpac(0, child);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    19
          child.style.display = 'block';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    20
          domOpacity(child, 0, 100, 1000);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    21
        }
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    22
        else
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    23
        {
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    24
          domOpacity(child, 100, 0, 1000);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    25
          setTimeout("document.getElementById('" + child.id + "').style.display = 'none';", 1050);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    26
        }
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    27
      }
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    28
    }
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    29
  }
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    30
  theme_list.sys_shown = ( mode == 'show' );
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    31
  document.getElementById('systheme_toggler').innerHTML = ( mode == 'hide' ) ? $lang.get('acptm_btn_system_themes_show') : $lang.get('acptm_btn_system_themes_hide');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    32
}
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    33
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    34
function ajaxInstallTheme(theme_id)
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    35
{
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    36
  var thediv = document.getElementById('themebtn_install_' + theme_id);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    37
  if ( !thediv )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    38
    return false;
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    39
  thediv.removeChild(thediv.getElementsByTagName('a')[0]);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    40
  var status = document.createElement('div');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    41
  status.className = 'status';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    42
  thediv.appendChild(status);
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    43
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    44
  var req = toJSONString({
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    45
      mode: 'install',
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    46
      theme_id: theme_id
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    47
    });
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    48
  // we've finished nukeing the existing interface, request editor data
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    49
  ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + ajaxEscape(req), function()
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    50
    {
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    51
      if ( ajax.readyState == 4 && ajax.status == 200 )
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    52
      {
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    53
        var response = String(ajax.responseText + '');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    54
        if ( response.substr(0, 1) == '{' )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    55
        {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    56
          response = parseJSON(response);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    57
          if ( response.mode == 'error' )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    58
          {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    59
            alert(response.error);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    60
            return false;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    61
          }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    62
        }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    63
        
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    64
        var theme_list = document.getElementById('theme_list_edit');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    65
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    66
        var btn = document.createElement('div');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    67
        btn.className = 'themebutton';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    68
        btn.style.backgroundImage = thediv.style.backgroundImage;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    69
        btn.id = 'themebtn_edit_' + theme_id;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    70
        
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    71
        var a = document.createElement('a');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    72
        a.className = 'tb-inner';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    73
        a.appendChild(document.createTextNode($lang.get('acptm_btn_theme_edit')));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    74
        a.appendChild(document.createTextNode("\n"));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    75
        a.theme_id = theme_id;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    76
        a.onclick = function()
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    77
        {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    78
          ajaxEditTheme(this.theme_id);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    79
          return false;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    80
        }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    81
        a.href = '#';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    82
        var span = document.createElement('span');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    83
        span.className = 'themename';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    84
        span.appendChild(document.createTextNode(thediv.getAttribute('enano:themename')));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    85
        a.appendChild(span);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    86
        btn.appendChild(a);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    87
        btn.setAttribute('enano:themename', thediv.getAttribute('enano:themename'));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    88
        theme_list.appendChild(btn);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    89
        
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    90
        thediv.parentNode.removeChild(thediv);
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    91
      }
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
    92
    });
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    93
}
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    94
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    95
function ajaxEditTheme(theme_id)
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    96
{
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    97
  // Fade out and subsequently destroy the entire list, then make an
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    98
  // ajax request to the theme manager for the theme info via JSON
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
    99
  var theme_list = document.getElementById('theme_list_edit').parentNode;
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   100
  var backgroundImage = document.getElementById('themebtn_edit_' + theme_id).style.backgroundImage;
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   101
  /*
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   102
  for ( var i = 0; i < theme_list.childNodes.length; i++ )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   103
  {
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   104
    var el = theme_list.childNodes[i];
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   105
    if ( el.tagName )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   106
      domOpacity(el, 100, 0, 1000);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   107
  }
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   108
  */
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   109
  var thediv = document.getElementById('themebtn_edit_' + theme_id);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   110
  if ( !thediv )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   111
    return false;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   112
  thediv.removeChild(thediv.getElementsByTagName('a')[0]);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   113
  var status = document.createElement('div');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   114
  status.className = 'status';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   115
  thediv.appendChild(status);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   116
  
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   117
  setTimeout(function()
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   118
    {
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   119
      var req = toJSONString({
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   120
          mode: 'fetch_theme',
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   121
          theme_id: theme_id
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   122
        });
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   123
      // we've finished nukeing the existing interface, request editor data
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   124
      ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + ajaxEscape(req), function()
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   125
        {
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   126
          if ( ajax.readyState == 4 && ajax.status == 200 )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   127
          {
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   128
            theme_list.innerHTML = '';
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   129
            var response = String(ajax.responseText + '');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   130
            if ( response.substr(0, 1) != '{' )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   131
            {
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   132
              alert(response);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   133
              return false;
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   134
            }
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   135
            response = parseJSON(response);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   136
            if ( response.mode == 'error' )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   137
            {
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   138
              alert(response.error);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   139
              return false;
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   140
            }
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   141
            response.background_image = backgroundImage;
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   142
            ajaxBuildThemeEditor(response, theme_list);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   143
          }
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   144
        });
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   145
    }, 200);
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   146
}
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   147
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   148
function ajaxBuildThemeEditor(data, target)
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   149
{
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   150
  // Build the theme editor interface
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   151
  // Init opacity
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   152
  domObjChangeOpac(0, target);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   153
  
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   154
  // Theme preview
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   155
  var preview = document.createElement('div');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   156
  preview.style.border = '1px solid #F0F0F0';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   157
  preview.style.padding = '5px';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   158
  preview.style.width = '216px';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   159
  preview.style.height = '150px';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   160
  preview.style.backgroundImage = data.background_image;
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   161
  preview.style.backgroundRepeat = 'no-repeat';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   162
  preview.style.backgroundPosition = 'center center';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   163
  preview.style.cssFloat = 'right';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   164
  preview.style.styleFloat = 'right';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   165
  
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   166
  target.appendChild(preview);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   167
  
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   168
  // Heading
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   169
  var h3 = document.createElement('h3');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   170
  h3.appendChild(document.createTextNode($lang.get('acptm_heading_theme_edit', { theme_name: data.theme_name })));
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   171
  target.appendChild(h3);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   172
  
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   173
  // Field: Theme name
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   174
  var l_name = document.createElement('label');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   175
  l_name.appendChild(document.createTextNode($lang.get('acptm_field_theme_name') + ' '));
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   176
  var f_name = document.createElement('input');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   177
  f_name.type = 'text';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   178
  f_name.id = 'themeed_field_name';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   179
  f_name.value = data.theme_name;
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   180
  f_name.size = '40';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   181
  l_name.appendChild(f_name);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   182
  target.appendChild(l_name);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   183
  
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   184
  target.appendChild(document.createElement('br'));
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   185
  target.appendChild(document.createElement('br'));
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   186
  
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   187
  // Field: default style
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   188
  var l_style = document.createElement('label');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   189
  l_style.appendChild(document.createTextNode($lang.get('acptm_field_default_style') + ' '));
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   190
  var f_style = document.createElement('select');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   191
  f_style.id = 'themeed_field_style';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   192
  var opts = [];
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   193
  for ( var i = 0; i < data.css.length; i++ )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   194
  {
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   195
    if ( data.css[i] == '_printable' )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   196
      continue;
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   197
    
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   198
    opts[i] = document.createElement('option');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   199
    opts[i].value = data.css[i];
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   200
    opts[i].appendChild(document.createTextNode(data.css[i]));
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   201
    if ( data.default_style == data.css[i] )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   202
    {
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   203
      opts[i].selected = true;
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   204
    }
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   205
    f_style.appendChild(opts[i]);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   206
  }
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   207
  l_style.appendChild(f_style);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   208
  target.appendChild(l_style);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   209
  
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   210
  target.appendChild(document.createElement('br'));
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   211
  target.appendChild(document.createElement('br'));
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   212
  
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   213
  // Default theme
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   214
  target.appendChild(document.createTextNode($lang.get('acptm_field_default_theme') + ' '));
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   215
  if ( data.is_default )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   216
  {
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   217
    var l_default = document.createElement('b');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   218
    l_default.appendChild(document.createTextNode($lang.get('acptm_field_default_msg_current')));
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   219
  }
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   220
  else
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   221
  {
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   222
    var l_default = document.createElement('label');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   223
    var f_default = document.createElement('input');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   224
    f_default.type = 'checkbox';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   225
    f_default.id = 'themeed_field_default';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   226
    l_default.appendChild(f_default);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   227
    l_default.appendChild(document.createTextNode($lang.get('acptm_field_default_btn_make_default')));
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   228
  }
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   229
  target.appendChild(l_default);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   230
  
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   231
  target.appendChild(document.createElement('br'));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   232
  target.appendChild(document.createElement('br'));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   233
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   234
  // Disable theme
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   235
  var disable_span = document.createElement('span');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   236
  disable_span.appendChild(document.createTextNode($lang.get('acptm_field_disable_title') + ' '));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   237
  target.appendChild(disable_span);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   238
  var l_disable = document.createElement('label');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   239
  var f_disable = document.createElement('input');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   240
  f_disable.type = 'checkbox';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   241
  f_disable.id = 'themeed_field_disable';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   242
  if ( !data.enabled )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   243
    f_disable.setAttribute('checked', 'checked');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   244
  l_disable.style.fontWeight = 'bold';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   245
  l_disable.appendChild(f_disable);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   246
  l_disable.appendChild(document.createTextNode($lang.get('acptm_field_disable')));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   247
  target.appendChild(l_disable);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   248
  
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   249
  // Availability policy
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   250
  var h3 = document.createElement('h3');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   251
  h3.appendChild(document.createTextNode($lang.get('acptm_heading_theme_groups')));
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   252
  target.appendChild(h3);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   253
  
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   254
  // Label for the whole field
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   255
  var p_d_policy = document.createElement('p');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   256
  p_d_policy.style.fontWeight = 'bold';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   257
  p_d_policy.appendChild(document.createTextNode($lang.get('acptm_field_policy')));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   258
  target.appendChild(p_d_policy);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   259
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   260
  // Wrapper for options
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   261
  var p_f_policy = document.createElement('p');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   262
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   263
  // Option: allow all
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   264
  var l_policy_allow_all = document.createElement('label');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   265
  var f_policy_allow_all = document.createElement('input');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   266
  f_policy_allow_all.type = 'radio';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   267
  f_policy_allow_all.id = 'themeed_field_policy_allow_all';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   268
  f_policy_allow_all.name = 'themeed_field_policy';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   269
  f_policy_allow_all.value = 'allow_all';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   270
  l_policy_allow_all.appendChild(f_policy_allow_all);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   271
  l_policy_allow_all.appendChild(document.createTextNode(' ' + $lang.get('acptm_field_policy_allow_all')));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   272
  if ( data.group_policy == 'allow_all' )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   273
  {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   274
    f_policy_allow_all.setAttribute('checked', 'checked');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   275
  }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   276
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   277
  // Option: whitelist
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   278
  var l_policy_whitelist = document.createElement('label');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   279
  var f_policy_whitelist = document.createElement('input');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   280
  f_policy_whitelist.type = 'radio';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   281
  f_policy_whitelist.id = 'themeed_field_policy_whitelist';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   282
  f_policy_whitelist.name = 'themeed_field_policy';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   283
  f_policy_whitelist.value = 'whitelist';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   284
  l_policy_whitelist.appendChild(f_policy_whitelist);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   285
  l_policy_whitelist.appendChild(document.createTextNode(' ' + $lang.get('acptm_field_policy_whitelist')));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   286
  if ( data.group_policy == 'whitelist' )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   287
  {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   288
    f_policy_whitelist.setAttribute('checked', 'checked');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   289
  }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   290
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   291
  // Option: blacklist
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   292
  var l_policy_blacklist = document.createElement('label');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   293
  var f_policy_blacklist = document.createElement('input');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   294
  f_policy_blacklist.type = 'radio';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   295
  f_policy_blacklist.id = 'themeed_field_policy_blacklist';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   296
  f_policy_blacklist.name = 'themeed_field_policy';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   297
  f_policy_blacklist.value = 'blacklist';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   298
  l_policy_blacklist.appendChild(f_policy_blacklist);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   299
  l_policy_blacklist.appendChild(document.createTextNode(' ' + $lang.get('acptm_field_policy_blacklist')));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   300
  if ( data.group_policy == 'blacklist' )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   301
  {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   302
    f_policy_blacklist.setAttribute('checked', 'checked');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   303
  }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   304
  f_policy_allow_all.onclick = ajaxThemeManagerHandlePolicyClick;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   305
  f_policy_whitelist.onclick = ajaxThemeManagerHandlePolicyClick;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   306
  f_policy_blacklist.onclick = ajaxThemeManagerHandlePolicyClick;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   307
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   308
  p_f_policy.appendChild(l_policy_allow_all);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   309
  p_f_policy.appendChild(document.createElement('br'));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   310
  p_f_policy.appendChild(l_policy_whitelist);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   311
  p_f_policy.appendChild(document.createElement('br'));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   312
  p_f_policy.appendChild(l_policy_blacklist);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   313
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   314
  target.appendChild(p_d_policy);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   315
  target.appendChild(p_f_policy);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   316
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   317
  var div_acl = document.createElement('div');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   318
  div_acl.id = 'themeed_acl_box';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   319
  div_acl.style.margin = '0 0 10px 30px';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   320
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   321
  var h3_g = document.createElement('h3');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   322
  h3_g.appendChild(document.createTextNode($lang.get('acptm_field_acl_heading_groups')));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   323
  div_acl.appendChild(h3_g);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   324
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   325
  var div_groups = document.createElement('div');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   326
  div_groups.style.border = '1px solid #E8E8E8';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   327
  div_groups.id = 'themeed_group_list';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   328
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   329
  // Group list
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   330
  for ( var i in data.group_names )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   331
  {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   332
    var g_name = data.group_names[i];
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   333
    var check = document.createElement('input');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   334
    check.type = 'checkbox';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   335
    if ( in_array("g:" + i, data.group_list) )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   336
    {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   337
      check.setAttribute('checked', 'checked');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   338
    }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   339
    check.group_id = parseInt(i);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   340
    var lbl_g_acl = document.createElement('label');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   341
    lbl_g_acl.appendChild(check);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   342
    // FIXME: l10n on group name
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   343
    lbl_g_acl.appendChild(document.createTextNode(g_name));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   344
    div_groups.appendChild(lbl_g_acl);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   345
    div_groups.appendChild(document.createElement('br'));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   346
  }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   347
  div_acl.appendChild(div_groups);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   348
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   349
  var h3_u = document.createElement('h3');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   350
  h3_u.appendChild(document.createTextNode($lang.get('acptm_field_acl_heading_users')));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   351
  div_acl.appendChild(h3_u);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   352
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   353
  // User addition field
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   354
  var frm = document.createElement('form');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   355
  frm.action = 'javascript:ajaxThemeManagerHandleUserAdd();';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   356
  frm.appendChild(document.createTextNode($lang.get('acptm_field_acl_add_user')));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   357
  var f_useradd = document.createElement('input');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   358
  f_useradd.type = 'text';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   359
  f_useradd.id = 'themeed_field_adduser';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   360
  f_useradd.onkeyup = function(e)
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   361
  {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   362
    new AutofillUsername(this, e, false);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   363
  }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   364
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   365
  frm.appendChild(f_useradd);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   366
  div_acl.appendChild(frm);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   367
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   368
  div_acl.appendChild(document.createElement('br'));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   369
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   370
  // User list
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   371
  var div_users = document.createElement('div');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   372
  div_users.style.border = '1px solid #E8E8E8';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   373
  div_users.style.padding = '4px';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   374
  div_users.id = 'themeed_user_list';
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   375
  for ( var i = 0; i < data.group_list.length; i++ )
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   376
  {
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   377
    var id = data.group_list[i];
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   378
    if ( id.substr(0, 2) != 'u:' )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   379
      continue;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   380
    var uid = id.substr(2);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   381
    var username = data.usernames[uid];
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   382
    
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   383
    var useritem = document.createElement('span');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   384
    useritem.appendChild(document.createTextNode(username + ' '));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   385
    useritem.userid = parseInt(uid);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   386
    var deleter = document.createElement('a');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   387
    deleter.href = '#';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   388
    deleter.onclick = function()
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   389
    {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   390
      ajaxThemeManagerHandleUserRemoval(this);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   391
      return false;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   392
    }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   393
    deleter.appendChild(document.createTextNode('[X]'));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   394
    useritem.appendChild(deleter);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   395
    div_users.appendChild(useritem);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   396
    div_users.appendChild(document.createElement('br'));
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   397
  }
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   398
  div_acl.appendChild(div_users);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   399
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   400
  target.appendChild(div_acl);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   401
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   402
  ajaxThemeManagerHandlePolicyClick();
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   403
  
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   404
  var clearer = document.createElement('span');
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   405
  clearer.className = 'menuclear';
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   406
  target.appendChild(clearer);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   407
  
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   408
  // Theme ID
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   409
  var tid = document.createElement('input');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   410
  tid.type = 'hidden';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   411
  tid.id = 'themeed_theme_id';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   412
  tid.value = data.theme_id;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   413
  target.appendChild(tid);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   414
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   415
  // Save button
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   416
  var raquo = unescape('%BB');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   417
  var savebtn = document.createElement('input');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   418
  savebtn.type = 'button';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   419
  savebtn.style.fontWeight = 'bold';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   420
  savebtn.value = $lang.get('etc_save_changes') + ' ' + raquo;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   421
  savebtn.onclick = function()
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   422
  {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   423
    ajaxThemeManagerHandleSaveRequest();
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   424
  }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   425
  target.appendChild(savebtn);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   426
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   427
  target.appendChild(document.createTextNode(' '));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   428
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   429
  // Cancel button
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   430
  var savebtn = document.createElement('input');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   431
  savebtn.type = 'button';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   432
  savebtn.value = $lang.get('etc_cancel');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   433
  savebtn.onclick = function()
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   434
  {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   435
    ajaxPage(namespace_list['Admin'] + 'ThemeManager');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   436
  }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   437
  target.appendChild(savebtn);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   438
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   439
  target.appendChild(document.createTextNode(' '));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   440
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   441
  // Uninstall button
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   442
  var savebtn = document.createElement('input');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   443
  savebtn.type = 'button';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   444
  savebtn.value = $lang.get('acptm_btn_uninstall_theme');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   445
  savebtn.style.color = '#D84308';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   446
  savebtn.onclick = function()
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   447
  {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   448
    if ( !confirm($lang.get('acptm_msg_uninstall_confirm')) )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   449
      return false;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   450
    ajaxThemeManagerHandleUninstallClick();
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   451
  }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   452
  target.appendChild(savebtn);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   453
  
435
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   454
  // Fade it all in
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   455
  domOpacity(target, 0, 100, 500);
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   456
  f_name.focus();
a434d60e525d And might as well add theme-manager.js while I'm at it.
Dan
parents:
diff changeset
   457
}
465
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   458
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   459
function ajaxThemeManagerHandlePolicyClick()
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   460
{
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   461
  if ( document.getElementById('themeed_field_policy_allow_all').checked )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   462
  {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   463
    document.getElementById('themeed_acl_box').style.display = 'none';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   464
  }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   465
  else if ( document.getElementById('themeed_field_policy_whitelist').checked || document.getElementById('themeed_field_policy_blacklist').checked )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   466
  {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   467
    document.getElementById('themeed_acl_box').style.display = 'block';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   468
  }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   469
}
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   470
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   471
function ajaxThemeManagerHandleUserAdd()
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   472
{
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   473
  var f_useradd = document.getElementById('themeed_field_adduser');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   474
  f_useradd.setAttribute('disabled', 'disabled');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   475
  var parent = f_useradd.parentNode;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   476
  var img = document.createElement('img');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   477
  img.src = ajax_load_icon;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   478
  img.id = 'themeed_useradd_status';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   479
  img.style.marginLeft = '10px';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   480
  insertAfter(parent, img, f_useradd);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   481
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   482
  var req = toJSONString({
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   483
      mode: 'uid_lookup',
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   484
      username: f_useradd.value
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   485
    });
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   486
  ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + ajaxEscape(req), function()
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   487
    {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   488
      if ( ajax.readyState == 4 && ajax.status == 200 )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   489
      {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   490
        var img = document.getElementById('themeed_useradd_status');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   491
        var f_useradd = document.getElementById('themeed_field_adduser');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   492
        
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   493
        f_useradd.disabled = null;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   494
        img.parentNode.removeChild(img);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   495
        
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   496
        // process response
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   497
        var response = String(ajax.responseText + '');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   498
        if ( response.substr(0, 1) != '{' )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   499
        {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   500
          alert(response);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   501
          return false;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   502
        }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   503
        response = parseJSON(response);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   504
        if ( response.mode == 'error' )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   505
        {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   506
          alert(response.error);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   507
          return false;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   508
        }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   509
            
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   510
        var uid = parseInt(response.uid);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   511
        var username = response.username;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   512
        
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   513
        // Loop through the list of users and remove any existing ones with the same uid
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   514
        var div_users = document.getElementById('themeed_user_list');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   515
        var children = div_users.getElementsByTagName('span');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   516
        for ( var i = 0; i < children.length; i++ )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   517
        {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   518
          var child = children[i];
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   519
          if ( child.userid == uid )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   520
          {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   521
            // the sister is the br element next to the span with the checkbox/text
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   522
            var sister = child.nextSibling;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   523
            div_users.removeChild(child);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   524
            div_users.removeChild(sister);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   525
            break;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   526
          }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   527
        }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   528
        
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   529
        var useritem = document.createElement('span');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   530
        useritem.appendChild(document.createTextNode(username + ' '));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   531
        useritem.userid = parseInt(uid);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   532
        var deleter = document.createElement('a');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   533
        deleter.href = '#';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   534
        deleter.onclick = function()
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   535
        {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   536
          ajaxThemeManagerHandleUserRemoval(this);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   537
          return false;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   538
        }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   539
        deleter.appendChild(document.createTextNode('[X]'));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   540
        useritem.appendChild(deleter);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   541
        div_users.appendChild(useritem);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   542
        div_users.appendChild(document.createElement('br'));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   543
      }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   544
    });
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   545
}
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   546
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   547
function ajaxThemeManagerHandleUserRemoval(el)
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   548
{
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   549
  var parent = el.parentNode;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   550
  var uid = parent.userid;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   551
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   552
  var grandparent = parent.parentNode;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   553
  var sister = parent.nextSibling;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   554
  grandparent.removeChild(parent);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   555
  grandparent.removeChild(sister);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   556
}
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   557
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   558
function ajaxThemeManagerHandleSaveRequest()
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   559
{
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   560
  // Build a JSON condensed request
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   561
  var md = false;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   562
  if ( document.getElementById('themeed_field_default') )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   563
  {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   564
    if ( document.getElementById('themeed_field_default').checked )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   565
    {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   566
      md = true;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   567
    }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   568
  }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   569
  var policy = 'allow_all';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   570
  if ( document.getElementById('themeed_field_policy_whitelist').checked )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   571
    policy = 'whitelist';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   572
  else if ( document.getElementById('themeed_field_policy_blacklist').checked )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   573
    policy = 'blacklist';
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   574
  var json_packet = {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   575
    theme_id: document.getElementById('themeed_theme_id').value,
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   576
    theme_name: document.getElementById('themeed_field_name').value,
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   577
    default_style: document.getElementById('themeed_field_style').value,
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   578
    make_default: md,
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   579
    group_policy: policy,
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   580
    enabled: ( document.getElementById('themeed_field_disable').checked ? false : true )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   581
  };
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   582
  var acl_list = [];
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   583
  var checks = document.getElementById('themeed_group_list').getElementsByTagName('input');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   584
  for ( var i = 0; i < checks.length; i++ )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   585
  {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   586
    if ( checks[i].checked )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   587
      acl_list.push('g:' + checks[i].group_id);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   588
  }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   589
  var spans = document.getElementById('themeed_user_list').getElementsByTagName('span');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   590
  for ( var i = 0; i < spans.length; i++ )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   591
  {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   592
    if ( spans[i].userid )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   593
      acl_list.push('u:' + spans[i].userid);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   594
  }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   595
  json_packet.group_list = acl_list;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   596
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   597
  var json_send = {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   598
    mode: 'save_theme',
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   599
    theme_data: json_packet
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   600
  };
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   601
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   602
  json_send = ajaxEscape(toJSONString(json_send));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   603
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   604
  // Request the save
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   605
  var parent = document.getElementById('ajaxPageContainer');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   606
  ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + json_send, function()
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   607
    {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   608
      if ( ajax.readyState == 4 && ajax.status == 200 )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   609
      {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   610
        // process response
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   611
        var response = String(ajax.responseText + '');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   612
        if ( response.substr(0, 1) != '{' )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   613
        {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   614
          // For this we actually *expect* an HTML response.
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   615
          parent.innerHTML = response;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   616
          return false;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   617
        }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   618
        response = parseJSON(response);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   619
        if ( response.mode == 'error' )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   620
        {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   621
          alert(response.error);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   622
          return false;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   623
        }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   624
      }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   625
    });
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   626
}
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   627
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   628
function ajaxThemeManagerHandleUninstallClick()
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   629
{
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   630
  var theme_id = document.getElementById('themeed_theme_id').value;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   631
  var json_send = {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   632
    mode: 'uninstall',
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   633
    theme_id: theme_id
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   634
  };
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   635
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   636
  json_send = ajaxEscape(toJSONString(json_send));
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   637
  
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   638
  // Request the action
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   639
  var parent = document.getElementById('ajaxPageContainer');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   640
  ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + json_send, function()
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   641
    {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   642
      if ( ajax.readyState == 4 && ajax.status == 200 )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   643
      {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   644
        // process response
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   645
        var response = String(ajax.responseText + '');
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   646
        if ( response.substr(0, 1) != '{' )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   647
        {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   648
          // For this we actually *expect* an HTML response.
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   649
          parent.innerHTML = response;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   650
          return false;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   651
        }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   652
        response = parseJSON(response);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   653
        if ( response.mode == 'error' )
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   654
        {
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   655
          alert(response.error);
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   656
          return false;
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   657
        }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   658
      }
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   659
    });
fe8b8c9b54e8 Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents: 435
diff changeset
   660
}