includes/clientside/sbedit.js
author Dan Fuhry <dan@enanocms.org>
Sun, 02 Jan 2011 03:12:04 -0500
changeset 1334 b9ecf7618fbc
parent 1274 673a1b6712fa
permissions -rw-r--r--
Added another AJAX editor hook after init is pretty much done
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1039
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
     1
var sbedit_load = function()
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
     2
  {
1039
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
     3
    if ( !window.jQuery )
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
     4
    {
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
     5
      load_component(['jquery', 'jquery-ui']);
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
     6
      // this seems to be the only way to make the sortables init properly
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
     7
      // FIXME find out what we're waiting for here, and wait on it the right way
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
     8
      window.setTimeout(sbedit_load, 200);
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
     9
      return true;
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    10
    }
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    11
    $('.sbedit-column').sortable({
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    12
      handle: '.sbedit-handle',
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    13
      connectWith: '.sbedit-column',
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    14
      stop: function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    15
      {
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    16
        ajaxUpdateSidebarOrder();
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    17
      }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    18
    });
1039
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    19
  };
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    20
  
1274
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    21
addOnloadHook(function()
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    22
	{
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    23
		attachHook('admin_page_onload', 'sbedit_conditional_init(t, qs);');
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    24
	});
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    25
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    26
// if the page was loaded directly this will be used instead
1039
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    27
addOnloadHook(sbedit_load);
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    28
1274
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    29
function sbedit_conditional_init(t, qs)
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    30
{
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    31
	if ( t != namespace_list.Admin + 'EditSidebar' )
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    32
		return false;
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    33
	
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    34
	if ( qs == '&action=new&id=0' )
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    35
		setType(document.getElementById('sbedit_create_select_type'));
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    36
	else
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    37
		sbedit_load();
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    38
}
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
    39
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    40
function serialize_sidebar()
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    41
{
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    42
  var columns = {};
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    43
  var i = 0;
1039
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    44
  try
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    45
  {
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    46
    $('.sbedit-column').each(function(i, e)
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    47
      {
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    48
        // console.debug(e, ' TOARRAY: ', $(e).sortable('toArray'));
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    49
        var arr = $(e).sortable('toArray');
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    50
        if ( !arr )
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    51
        {
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    52
          console.error('Retrieving order failed!');
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    53
          throw new Exception();
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    54
        }
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    55
          
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    56
        for ( var j = 0; j < arr.length; j++ )
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    57
          arr[j] = parseInt(arr[j].replace(/^block:/, ''));
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    58
        
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    59
        i++;
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    60
        columns[i] = arr;
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    61
      });
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    62
  }
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    63
  catch ( e )
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    64
  {
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    65
    return false;
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
    66
  }
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    67
  return toJSONString(columns);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    68
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    69
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    70
function sbedit_open_editor(a)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    71
{
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    72
  if ( auth_level < USER_LEVEL_ADMIN )
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    73
  {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    74
    load_component('login');
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    75
    ajaxDynamicReauth(function(sid)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    76
      {
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    77
        sbedit_open_editor(a);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    78
      }, USER_LEVEL_ADMIN);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    79
    return false;
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    80
  }
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    81
  load_component(['fadefilter', 'l10n']);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    82
  var shade = darken(true, 50, 'sbedit-shade');
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    83
  $(shade).css('z-index', 0);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    84
  var parent = sbedit_get_parent(a);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    85
  var offset = $(parent).offset();
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    86
  var top = (( getHeight() ) / 2) - 200 + getScrollOffset();
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    87
  var box = $(parent)
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    88
    .clone()
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    89
    .empty()
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    90
    .attr('id', 'sb_blockedit')
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    91
    .addClass('sbedit-float')
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    92
    .css('height', $(parent).height())
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    93
    .css('top', offset.top)
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    94
    .css('left', offset.left)
943
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
    95
    .appendTo('body');
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
    96
  var item_id = parseInt($(parent).attr('id').replace(/^block:/, ''));
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
    97
  
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
    98
  $(box)
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
    99
    .animate({ width: 500, height: 400, top: top, left: (getWidth() / 2) - 250 }, 400, function()
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   100
      {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   101
        var whitey = whiteOutElement(this);
943
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   102
        $(this).append('<textarea style="width: 98%; height: 360px; margin: 0 auto; display: block;" rows="20" cols="80"></textarea>');
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   103
        $(this).append('<p style="text-align: center;"><a href="#" onclick="sbedit_edit_save(this); return false;">' + $lang.get('etc_save_changes') + '</a> | <a href="#" onclick="sbedit_edit_cancel(this); return false;">' + $lang.get('etc_cancel') + '</a></p>');
1274
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   104
        $.get(makeUrlNS('Admin', 'EditSidebar', 'action=getsource&noheaders&id=' + item_id), {}, function(response, statustext)
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   105
          {
943
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   106
            $('textarea', box).val(response);
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   107
            $(whitey).remove();
943
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   108
            
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   109
            $(box).attr('enano:item_id', item_id);
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   110
          }, 'html');
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   111
      })
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   112
    .get(0);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   113
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   114
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   115
function sbedit_edit_save(a)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   116
{
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   117
  var box = a.parentNode.parentNode;
943
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   118
  var parent = document.getElementById('block:' + $(box).attr('enano:item_id'));
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   119
  var whitey = whiteOutElement(box);
1274
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   120
  $.post(makeUrlNS('Admin', 'EditSidebar', 'noheaders&action=save&id=' + $(box).attr('enano:item_id')), { content: $('textarea', box).attr('value') }, function(response, statustext)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   121
    {
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   122
      whiteOutReportSuccess(whitey);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   123
      setTimeout(function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   124
        {
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   125
          sbedit_close_editor(parent, box);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   126
        }, 1250);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   127
    }, 'html');
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   128
}
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   129
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   130
function sbedit_edit_cancel(a)
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   131
{
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   132
  var box = a.parentNode.parentNode;
943
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   133
  var parent = document.getElementById('block:' + $(box).attr('enano:item_id'));
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   134
  
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   135
  sbedit_close_editor(parent, box);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   136
}
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   137
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   138
function sbedit_close_editor(parent, box)
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   139
{
943
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   140
  if ( !parent )
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   141
  {
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   142
    console.warn('Failed to get DOM object for parent, skipping transition effect');
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   143
  }
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   144
  
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   145
  if ( jQuery.fx.off || !parent )
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   146
  {
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   147
    enlighten(true, 'sbedit-shade');
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   148
    $('body').get(0).removeChild(box);
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   149
    return true;
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   150
  }
6eab82abc952 Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents: 886
diff changeset
   151
  
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   152
  var offset = $(parent).offset();
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   153
  $(box).empty().animate(
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   154
    {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   155
      width:  $(parent).width(),
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   156
      height: $(parent).height(),
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   157
      top:    offset.top,
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   158
      left:   offset.left,
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   159
    }, 400, function()
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   160
    {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   161
      $(this).css('background-color', '#f70').fadeOut(1000, function() { $(this).remove(); });
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   162
      enlighten(true, 'sbedit-shade');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   163
    });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   164
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   165
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   166
function sbedit_delete_block(a)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   167
{
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   168
  var parent = sbedit_get_parent(a);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   169
  load_component(['messagebox', 'fadefilter', 'flyin', 'l10n']);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   170
  var mp = miniPromptMessage({
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   171
      title: $lang.get('sbedit_msg_delete_confirm_title'),
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   172
      message: $lang.get('sbedit_msg_delete_confirm_body'),
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   173
      buttons: [
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   174
        {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   175
          text: $lang.get('sbedit_btn_delete_confirm'),
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   176
          color: 'red',
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   177
          onclick: function()
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   178
          {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   179
            var mp = miniPromptGetParent(this);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   180
            sbedit_delete_block_s2(mp.target_block);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   181
            miniPromptDestroy(this);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   182
            return false;
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   183
          },
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   184
          style: {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   185
            fontWeight: 'bold'
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   186
          }
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   187
        },
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   188
        {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   189
          text: $lang.get('etc_cancel'),
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   190
          onclick: function()
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   191
          {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   192
            miniPromptDestroy(this);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   193
            return false;
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   194
          }
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   195
        }
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   196
      ]
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   197
    });
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   198
  mp.target_block = parent;
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   199
}
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   200
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   201
function sbedit_delete_block_s2(box)
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   202
{
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   203
  var parent = box;
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   204
  var id = parseInt($(parent).attr('id').replace(/^block:/, ''));
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   205
  var whitey = whiteOutElement(parent);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   206
  
1274
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   207
  $.get(makeUrlNS('Admin', 'EditSidebar', 'action=delete&ajax=true&noheaders&id=' + id), function(response, statustext)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   208
    {
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   209
      if ( response == 'GOOD' )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   210
      {
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   211
        whiteOutReportSuccess(whitey);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   212
        setTimeout(function()
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   213
          {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   214
            $(parent)
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   215
            .hide('blind', { duration: 500 }, function()
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   216
              {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   217
                $(this).remove();
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   218
                ajaxUpdateSidebarOrder();
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   219
              });
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   220
          }, 1250);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   221
      }
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   222
      else
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   223
      {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   224
        whiteOutReportFailure(whitey);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   225
        alert(response);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   226
      }
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   227
    }, 'html');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   228
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   229
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   230
function sbedit_rename_block(a)
190
e858bacb5cfa Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents: 80
diff changeset
   231
{
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   232
  var parent = sbedit_get_parent(a);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   233
  $('div.sbedit-handle > span', parent).hide();
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   234
  var input = $('div.sbedit-handle > input', parent).show().focus().select().keyup(function(e)
190
e858bacb5cfa Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents: 80
diff changeset
   235
    {
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   236
      switch(e.keyCode)
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   237
      {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   238
        case 13:
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   239
          // enter
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   240
          var whitey = whiteOutElement(this.parentNode);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   241
          var me = this;
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   242
          var id = parseInt($(parent).attr('id').replace(/^block:/, ''));
1274
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   243
          $.post(makeUrlNS('Admin', 'EditSidebar', 'ajax&noheaders&action=rename&id='+id), { newname: $(this).attr('value') }, function(response, statustext)
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   244
            {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   245
              if ( response == 'GOOD' )
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   246
              {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   247
                whiteOutReportSuccess(whitey);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   248
                setTimeout(function()
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   249
                  {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   250
                    $(me).hide();
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   251
                    $('span', me.parentNode).show().text(me.value);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   252
                  }, 1250);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   253
              }
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   254
              else
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   255
              {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   256
                alert(response);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   257
                whiteOutReportFailure(whitey);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   258
              }
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   259
            }, 'html');
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   260
          break;
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   261
        case 27:
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   262
          // escape
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   263
          this.value = this.origvalue;
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   264
          $(this).hide();
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   265
          $('span', this.parentNode).show();
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   266
          break;
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   267
      }
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   268
    }).get(0);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   269
  input.origvalue = input.value;
190
e858bacb5cfa Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents: 80
diff changeset
   270
}
e858bacb5cfa Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents: 80
diff changeset
   271
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   272
function sbedit_disenable_block(a)
190
e858bacb5cfa Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents: 80
diff changeset
   273
{
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   274
  var parent = sbedit_get_parent(a);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   275
  var whitey = whiteOutElement(parent);
1274
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   276
  $.get(makeUrlNS('Admin', 'EditSidebar', 'action=disenable&ajax=true&noheaders&id=' + parseInt($(parent).attr('id').replace(/^block:/, ''))), {}, function(response, statustext)
190
e858bacb5cfa Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents: 80
diff changeset
   277
    {
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   278
      if ( response == 'GOOD' )
190
e858bacb5cfa Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents: 80
diff changeset
   279
      {
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   280
        whiteOutReportSuccess(whitey);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   281
        $(parent).toggleClass('disabled');
190
e858bacb5cfa Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents: 80
diff changeset
   282
      }
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   283
      else
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   284
      {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   285
        whiteOutReportFailure(whitey);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   286
        alert(response);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   287
      }
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   288
    }, 'html');
190
e858bacb5cfa Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents: 80
diff changeset
   289
}
e858bacb5cfa Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents: 80
diff changeset
   290
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   291
function sbedit_get_parent(a)
190
e858bacb5cfa Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents: 80
diff changeset
   292
{
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   293
  var o = a.parentNode;
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   294
  while ( !$(o).hasClass('sbedit-block') )
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   295
    o = o.parentNode;
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   296
  
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   297
  return o;
190
e858bacb5cfa Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents: 80
diff changeset
   298
}
e858bacb5cfa Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents: 80
diff changeset
   299
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   300
function ajaxUpdateSidebarOrder()
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   301
{
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   302
  setAjaxLoading();
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   303
  var ser = serialize_sidebar();
1039
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   304
  if ( !ser )
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   305
  {
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   306
    var msg = document.createElement('div');
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   307
    $(msg)
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   308
      .addClass('error-box-mini')
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   309
      .text('jQuery failure: returned invalid serialized sidebar data')
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   310
      .css('position', 'fixed')
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   311
      .css('bottom', 1)
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   312
      .appendTo('body')
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   313
      .css('left', ( getWidth() / 2 ) - ( $(msg).width() / 2 ));
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   314
    setTimeout(function()
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   315
      {
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   316
        $(msg).fadeOut(500, function() { $(this).remove(); });
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   317
      }, 1000);
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   318
    unsetAjaxLoading();
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   319
    return false;
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   320
  }
1274
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   321
  $.post(makeUrlNS('Admin', 'EditSidebar', 'update_order'), { order: ser }, function(response, statustext)
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   322
    {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   323
      var msg = document.createElement('div');
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   324
      $(msg)
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   325
        .addClass('info-box-mini')
1039
4226cedb3bc4 Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents: 943
diff changeset
   326
        .text($lang.get('sbedit_msg_order_saved'))
885
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   327
        .css('position', 'fixed')
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   328
        .css('bottom', 1)
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   329
        .appendTo('body')
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   330
        .css('left', ( getWidth() / 2 ) - ( $(msg).width() / 2 ));
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   331
      setTimeout(function()
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   332
        {
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   333
          $(msg).fadeOut(500, function() { $(this).remove(); });
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   334
        }, 1000);
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   335
      unsetAjaxLoading();
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   336
    }, 'json');
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   337
}
a86a69394a95 Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents: 407
diff changeset
   338
1274
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   339
function setType(input)
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   340
{
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   341
	val = input.value;
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   342
	if(!val)
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   343
	{
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   344
		return false;
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   345
	}
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   346
	var divs = getElementsByClassName(document, 'div', 'sbadd_block');
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   347
	for(var i in divs)
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   348
	{
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   349
		if(divs[i].id == 'blocktype_'+val) divs[i].style.display = 'block';
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   350
		else divs[i].style.display = 'none';
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   351
	}
673a1b6712fa Moved sidebar editor into the admin CP. Icon still needs to be added, no Internet right now to go find one. Also fixed a few template related things.
Dan
parents: 1039
diff changeset
   352
}