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.
authorDan
Sun, 22 Mar 2009 00:55:06 -0400
changeset 885 a86a69394a95
parent 884 d6c7b310295d
child 886 041c86ff16d5
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.
images/rename.png
includes/clientside/css/enano-shared.css
includes/clientside/dbx-key.js
includes/clientside/dbx.css
includes/clientside/dbx.js
includes/clientside/md5.js
includes/clientside/sbedit.js
language/english/admin.json
plugins/SpecialAdmin.php
themes/admin/sidebar-editor.tpl
themes/oxygen/css/bleu.css
themes/oxygen/sidebar-editor.tpl
themes/printable/sidebar-editor.tpl
themes/stpatty/sidebar-editor.tpl
Binary file images/rename.png has changed
--- a/includes/clientside/css/enano-shared.css	Sun Mar 22 00:46:44 2009 -0400
+++ b/includes/clientside/css/enano-shared.css	Sun Mar 22 00:55:06 2009 -0400
@@ -150,6 +150,11 @@
   padding-right: 5px;
 }
 
+div.toolbar_vert li > span {
+  display: block;
+  padding: 4px 5px;
+}
+
 div.breadcrumbs                   { margin: 10px 0; padding: 5px; border: 1px solid #AAAAAA; background-color: #E8E8E8; font-size: smaller; font-weight: bold; }
 
 /* Tables */
@@ -325,55 +330,6 @@
   display: block;
 }
 
-/*
- * Docking Boxes code (for the sidebar editor)
- */
- 
-/* group container(s) */
-#sbedit {
-  margin: 0;
-  padding: 0;
-  /* position:relative; /* additional outer containers must also have position:relative */
-}
-/* keyboard navigation tooltip */
-.dbx-tooltip {
-  display:block;
-  position:absolute;
-  margin:36px 0 0 125px;
-  width:185px;
-  border:1px solid #000;
-  background:#ffd;
-  color:#000;
-  font:normal normal normal 0.85em tahoma, arial, sans-serif;
-  padding:2px 4px 3px 5px;
-  text-align:left;
-  }
-* html .dbx-tooltip { width:195px; }
-
-/* use CSS2 system colors in CSS2 browsers 
-   but not safari, which doesn't support them */
-*[class="dbx-tooltip"]:lang(en) {
-  border-color:InfoText;
-  background:InfoBackground;
-  color:InfoText;
-  font:small-caption;
-  font-weight:normal;
-  }
-/* additional clone styles */
-.dbx-clone {
-  opacity: 0.8;
-}
-.dbx-content ul {
-  margin: 0; padding: 0;
-  list-style: none;
-}
-.dbx-content li a, .dbx-content li a:hover {
-  text-decoration: none; color: #666;
-}
-.dbx-content2 {
-  margin: 0px 1px 0px 1px;
-}
-
 /* Progress bars */
 div.progressbar {
   padding: 2px;
@@ -1002,3 +958,63 @@
   background-repeat: no-repeat;
   margin: 0 auto;
 }
+
+/**
+ * Sidebar editor
+ */
+
+div.sbedit-block {
+  background-color: #f7f7f7;
+  border: 1px solid #c2c2c2;
+  padding: 4px;
+  width: 150px;
+  margin: 0 7px 5px 0;
+}
+
+div.sbedit-block.disabled {
+  background-color: #ffe2e2;
+  border-color: #c7a1a1;
+}
+
+div.sbedit-handle {
+  background-color: #c7c7c7;
+  border: 1px solid #909090;
+  padding: 2px;
+  margin-bottom: 3px;
+  cursor: move;
+}
+
+div.sbedit-block.disabled div.sbedit-handle {
+  background-color: #c77272;
+  border-color: #aa6060;
+}
+
+div.sbedit-handle input {
+  display: none;
+  width: 96%;
+}
+
+div.sbedit-float {
+  position: absolute;
+  top: 20px;
+  left: 20px;
+}
+
+td.sbedit-column {
+  vertical-align: top;
+  /* 150 + 4*2 + 7 + 3 (the 3 being a trial-and-error computation) */
+  width: 168px;
+}
+
+.ui-sortable-placeholder {
+  background-color: #e2e2e2 !important;
+  border: 1px dashed #b7b7b7 !important;
+  visibility: visible !important;
+  height: 50px !important;
+}
+
+.ui-sortable-helper {
+  opacity: 0.6;
+  filter: alpha(opacity=60);
+}
+
--- a/includes/clientside/dbx-key.js	Sun Mar 22 00:46:44 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-function dbx_set_key()
-{
-  //initialise the docking boxes manager
-  var manager = new dbxManager('main');   //session ID [/-_a-zA-Z0-9/]
-  
-  //onstatechange fires when any group state changes
-	manager.onstatechange = function()
-	{
-		//copy the state string to a local var
-		var state = this.state;
-
-		//remove group name and open/close state tokens
-		state = state.replace(/sbedit_(left|right)=/ig, '').replace(/[\-\+]/g, '');
-
-		//split into an array
-    state = state.split('&');
-    
-		//output field
-		var field = document.getElementById('divOrder_Left');
-    field.value = state[0];
-    var field = document.getElementById('divOrder_Right');
-    field.value = state[1];
-
-		//return value determines whether cookie is set
-		return false;
-	};
-  
-  //create new docking boxes group
-  var sbedit_left = new dbxGroup(
-    'sbedit_left',   // container ID [/-_a-zA-Z0-9/]
-    'vertical', // orientation ['vertical'|'horizontal']
-    '7',        // drag threshold ['n' pixels]
-    'no',       // restrict drag movement to container axis ['yes'|'no']
-    '10',       // animate re-ordering [frames per transition, or '0' for no effect]
-    'no',       // include open/close toggle buttons ['yes'|'no']
-    'open',     // default state ['open'|'closed']
-    'open',     // word for "open", as in "open this box"
-    'close',    // word for "close", as in "close this box"
-    'click-down and drag to move this box',     // sentence for "move this box" by mouse
-    'click to %toggle% this box',               // pattern-match sentence for "(open|close) this box" by mouse
-    'use the arrow keys to move this box',      // sentence for "move this box" by keyboard
-    ', or press the enter key to %toggle% it',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard
-    '%mytitle%  [%dbxtitle%]'                   // pattern-match syntax for title-attribute conflicts
-  );
-  
-  //create new docking boxes group
-  var sbedit_right = new dbxGroup(
-    'sbedit_right',   // container ID [/-_a-zA-Z0-9/]
-    'vertical', // orientation ['vertical'|'horizontal']
-    '7',        // drag threshold ['n' pixels]
-    'no',       // restrict drag movement to container axis ['yes'|'no']
-    '10',       // animate re-ordering [frames per transition, or '0' for no effect]
-    'no',       // include open/close toggle buttons ['yes'|'no']
-    'open',     // default state ['open'|'closed']
-    'open',     // word for "open", as in "open this box"
-    'close',    // word for "close", as in "close this box"
-    'click-down and drag to move this box',     // sentence for "move this box" by mouse
-    'click to %toggle% this box',               // pattern-match sentence for "(open|close) this box" by mouse
-    'use the arrow keys to move this box',      // sentence for "move this box" by keyboard
-    ', or press the enter key to %toggle% it',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard
-    '%mytitle%  [%dbxtitle%]'                   // pattern-match syntax for title-attribute conflicts
-  );
-}
--- a/includes/clientside/dbx.css	Sun Mar 22 00:46:44 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/****************************************************************
-  Docking Boxes core CSS: YOU MUST NOT CHANGE OR OVERRIDE THESE 
-*****************************************************************/
-.dbx-clone {
-	position:absolute;
-	visibility:hidden;
-	}
-.dbx-clone, .dbx-clone .dbx-handle-cursor {
-	cursor:move !important;
-	}
-.dbx-dummy {
-	display:block;
-	width:0;
-	height:0;
-	overflow:hidden;
-	}
-.dbx-group, .dbx-box, .dbx-handle {
-	position:relative;
-	display:block;
-	}
-
-
-
-/****************************************************************
-  avoid padding, margins or borders on dbx-box, 
-  to reduce visual discrepancies between it and the clone.  
-  overall, dbx-box is best left as visually unstyled as possible 
-*****************************************************************/
-.dbx-box {
-	margin:0;
-	padding:0;
-	border:none;
-	}
-
--- a/includes/clientside/dbx.js	Sun Mar 22 00:46:44 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-// DBX2.05 :: Docking Boxes (dbx)
-// *****************************************************
-// DOM scripting by brothercake -- http://www.brothercake.com/
-// GNU Lesser General Public License -- http://www.gnu.org/licenses/lgpl.html
-//******************************************************
-var dbx;function dbxManager(sid){dbx = this;if(!/^[-_a-z0-9]+$/i.test(sid)) { alert('Error from dbxManager:\n"' + sid + '" is an invalid session ID'); return; }this.supported = !(document.getElementsByTagName('*').length == 0 || (navigator.vendor == 'KDE' && typeof window.sidebar == 'undefined'));if(!this.supported) { return; }this.etype = typeof document.addEventListener != 'undefined' ? 'addEventListener' : typeof document.attachEvent != 'undefined' ? 'attachEvent' : 'none';this.eprefix = (this.etype == 'attachEvent' ? 'on' : '');if(typeof window.opera != 'undefined' && parseFloat(navigator.userAgent.toLowerCase().split(/opera[\/ ]/)[1].split(' ')[0], 10) < 7.5){this.etype = 'none';}if(this.etype == 'none') { this.supported = false; return; }this.running = 0;this.sid = sid;this.savedata = {};this.cookiestate = this.getCookieState();};dbxManager.prototype.setCookieState = function(){var now = new Date();now.setTime(now.getTime() + (365*24*60*60*1000));var str = '';for(j in this.savedata){if(typeof this.savedata[j]!='function'){str += j + '=' + this.savedata[j] + '&'}}this.state = str.replace(/^(.+)&$/, '$1');this.cookiestring = this.state.replace(/,/g, '|');this.cookiestring = this.cookiestring.replace(/=/g, ':');if(typeof this.onstatechange == 'undefined' || this.onstatechange()){document.cookie = 'dbx-' + this.sid + '='+ this.cookiestring+ '; expires=' + now.toGMTString()+ '; path=/';}};dbxManager.prototype.getCookieState = function(){this.cookiestate = null;if(document.cookie){if(document.cookie.indexOf('dbx-' + this.sid)!=-1){this.cookie = document.cookie.split('dbx-' + this.sid + '=')[1].split(';')[0].split('&');for(var i in this.cookie){if(typeof this.cookie[i]!='function'){this.cookie[i] = this.cookie[i].replace(/\|/g, ',');this.cookie[i]= this.cookie[i].replace(/:/g, '=');this.cookie[i] = this.cookie[i].split('=');this.cookie[i][1] = this.cookie[i][1].split(',');}}this.cookiestate = {};for(i in this.cookie){if(typeof this.cookie[i]!='function'){this.cookiestate[this.cookie[i][0]] = this.cookie[i][1];}}}}return this.cookiestate;};dbxManager.prototype.addDataMember = function(gid, order){this.savedata[gid] = order;};dbxManager.prototype.createElement = function(tag){return typeof document.createElementNS != 'undefined' ? document.createElementNS('http://www.w3.org/1999/xhtml', tag) : document.createElement(tag);};dbxManager.prototype.getTarget = function(e, pattern, node){if(typeof node != 'undefined'){var target = node;}else{target = typeof e.target != 'undefined' ? e.target : e.srcElement;}var regex = new RegExp(pattern, '');while(!regex.test(target.className)){target = target.parentNode;}return target;};function dbxGroup(gid, dir, thresh, fix, ani, togs, def, open, close, move, toggle, kmove, ktoggle, syntax){if(!/^[-_a-z0-9]+$/i.test(gid)) { alert('Error from dbxGroup:\n"' + gid + '" is an invalid container ID'); return; }this.container = document.getElementById(gid);if(this.container == null || !dbx.supported) { return; }var self = this;this.gid = gid;this.dragok = false;this.box = null;this.vertical = dir == 'vertical';this.threshold = parseInt(thresh, 10);this.restrict = fix == 'yes';this.resolution = parseInt(ani, 10);this.toggles = togs == 'yes';this.defopen = def != 'closed';this.vocab = {'open' : open,'close' : close,'move' : move,'toggle' : toggle,'kmove' : kmove,'ktoggle' : ktoggle,'syntax' : syntax};this.container.style.position = 'relative';this.container.style.display = 'block';if(typeof window.opera != 'undefined'){this.container.style.display = 'run-in';}this.boxes = [];this.buttons = [];this.order = [];this.eles = this.container.getElementsByTagName('*');for(var i=0; i<this.eles.length; i++){if(/dbx\-box/i.test(this.eles[i].className) && !/dbx\-dummy/i.test(this.eles[i].className)){this.eles[i].style.position = 'relative';this.eles[i].style.display = 'block';this.boxes.push(this.eles[i]);this.eles[i].className += ' dbx-box-open';this.eles[i].className += ' dbxid' + this.order.length;this.order.push(this.order.length.toString() + '+');this.eles[i][dbx.etype](dbx.eprefix + 'mousedown', function(e){if(!e) { e = window.event; }self.mousedown(e, dbx.getTarget(e, 'dbx\-box'));}, false);}if(/dbx\-handle/i.test(this.eles[i].className)){this.eles[i].style.position = 'relative';this.eles[i].style.display = 'block';this.eles[i].className += ' dbx-handle-cursor';this.eles[i].setAttribute('title', this.eles[i].getAttribute('title') == null || this.eles[i].title == '' ? this.vocab.move : this.vocab.syntax.replace('%mytitle%', this.eles[i].title).replace('%dbxtitle%', this.vocab.move));if(this.toggles){this.buttons.push(this.addToggleBehavior(this.eles[i]));}else{this.eles[i][dbx.etype](dbx.eprefix + 'key' + (typeof document.uniqueID != 'undefined' || navigator.vendor == 'Apple Computer, Inc.' ? 'down' : 'press'), function(e){if(!e) { e = window.event; }return self.keypress(e, dbx.getTarget(e, 'dbx\-handle'));}, false);this.eles[i][dbx.etype](dbx.eprefix + 'focus', function(e){if(!e) { e = window.event; }self.createTooltip(null, dbx.getTarget(e, 'dbx\-handle'));}, false);this.eles[i][dbx.etype](dbx.eprefix + 'blur', function(){self.removeTooltip();}, false);}}}dbx.addDataMember(this.gid, this.order.join(','));var dummy = this.container.appendChild(dbx.createElement('span'));dummy.className = 'dbx-box dbx-dummy';dummy.style.display = 'block';dummy.style.width = '0';dummy.style.height = '0';dummy.style.overflow = 'hidden';if(this.vertical) { dummy.className += ' dbx-offdummy'; }this.boxes.push(dummy);if(dbx.cookiestate != null && typeof dbx.cookiestate[this.gid] != 'undefined'){var num = dbx.cookiestate[this.gid].length;if(num == this.boxes.length - 1){for(i=0; i<num; i++){var index = parseInt(dbx.cookiestate[this.gid][i], 10);this.container.insertBefore(this.boxes[index], dummy);if(this.toggles && /\-$/.test(dbx.cookiestate[this.gid][i])){this.toggleBoxState(this.buttons[index], false);}}this.getBoxOrder();}}else if(!this.defopen && this.toggles){var len = this.buttons.length;for(i=0; i<len; i++){this.toggleBoxState(this.buttons[i], true);}}document[dbx.etype](dbx.eprefix + 'mouseout', function(e){if(typeof e.target == 'undefined') { e = window.event; e.relatedTarget = e.toElement; }if(e.relatedTarget == null){self.mouseup(e);}}, false);document[dbx.etype](dbx.eprefix + 'mousemove', function(e){self.mousemove(e);return !self.dragok;}, false);document[dbx.etype](dbx.eprefix + 'mouseup', function(e){self.mouseup(e);}, false);this.keydown = false;document[dbx.etype](dbx.eprefix + 'keydown', function(){self.keydown = true;}, false);document[dbx.etype](dbx.eprefix + 'keyup', function(){self.keydown = false;}, false);};dbxGroup.prototype.addToggleBehavior = function(){var self = this;var button = arguments[0].appendChild(dbx.createElement('a'));button.appendChild(document.createTextNode('\u00a0'));button.style.cursor = 'pointer';button.href = 'javascript:void(null)';button.className = ( button.className ) ? button.className+' dbx-toggle dbx-toggle-open' : 'dbx-toggle dbx-toggle-open';button.setAttribute('title', this.vocab.toggle.replace('%toggle%', this.vocab.close));button.hasfocus = typeof window.opera != 'undefined' || navigator.vendor == 'Apple Computer, Inc.' ? null : false;this.tooltip = null;button.onclick = function(){if(this.hasfocus === true || this.hasfocus === null){self.removeTooltip();self.toggleBoxState(this, true);}};button['onkey' + (typeof document.uniqueID != 'undefined' || navigator.vendor == 'Apple Computer, Inc.' ? 'down' : 'press')] = function(e){if(!e) { e = window.event; }return self.keypress(e, this);};button.onfocus = function(){var len = self.buttons.length;for(var i=0; i<len; i++){self.buttons[i].className = self.buttons[i].className.replace(/[ ](dbx\-toggle\-hilite\-)(open|closed)/, '');}var isopen = (/dbx\-toggle\-open/.test(this.className));this.className += ' dbx-toggle-hilite-' + (isopen ? 'open' : 'closed');self.createTooltip(isopen, this);this.isactive = true;if(this.hasfocus !== null) { this.hasfocus = true; }};button.onblur = function(){this.className = this.className.replace(/[ ](dbx\-toggle\-hilite\-)(open|closed)/, '');self.removeTooltip();if(this.hasfocus !== null) { this.hasfocus = false; }};return button;};dbxGroup.prototype.toggleBoxState = function(button, regen){var isopen = (/dbx\-toggle\-open/.test(button.className));var parent = dbx.getTarget(null, 'dbx\-box', button);dbx.box = parent;dbx.toggle = button;if(typeof dbx.container == 'undefined'){dbx.group = dbx.getTarget(null, 'dbx\-group', parent);}else { dbx.group = dbx.container; }if((!isopen && (typeof dbx.onboxopen == 'undefined' || dbx.onboxopen()))||(isopen && (typeof dbx.onboxclose == 'undefined' || dbx.onboxclose()))){cn = 'dbx-toggle dbx-toggle-' + (isopen ? 'closed' : 'open');button.className = ( button.className ) ? button.className+' '+cn : cn;button.title = this.vocab.toggle.replace('%toggle%', isopen ? this.vocab.open : this.vocab.close);if(typeof button.isactive != 'undefined'){button.className += ' dbx-toggle-hilite-' + (isopen ? 'closed' : 'open')}parent.className = parent.className.replace(/[ ](dbx-box-)(open|closed)/, ' $1' + (isopen ? 'closed' : 'open'));if(regen) { this.getBoxOrder(); }}};dbxGroup.prototype.shiftBoxPosition = function(e, anchor, positive){var parent = dbx.getTarget(null, 'dbx\-box', anchor);dbx.group = this.container;dbx.box = parent;dbx.event = e;if(typeof dbx.onboxdrag == 'undefined' || dbx.onboxdrag()){var positions = [];var len = this.boxes.length;for(var i=0; i<len; i++){positions[i] = [i, this.boxes[i][this.vertical ? 'offsetTop' : 'offsetLeft']];if(parent == this.boxes[i]) { this.idref = i; }}positions.sort(this.compare);for(i=0; i<len; i++){if(positions[i][0] == this.idref){if((positive && i < len - 2) || (!positive && i > 0)){var sibling = this.boxes[positions[i + (positive ? 1 : -1)][0]];if(this.resolution > 0){var visipos = { 'x' : parent.offsetLeft, 'y' : parent.offsetTop };var siblingpos = { 'x' : sibling.offsetLeft, 'y' : sibling.offsetTop };}var obj = { 'insert' : (positive ? sibling : parent), 'before' : (positive ? parent : sibling) };this.container.insertBefore(obj.insert, obj.before);if(this.resolution > 0){var animators ={'sibling' : new dbxAnimator(this, sibling, siblingpos, this.resolution, true, anchor),'parent' : new dbxAnimator(this, parent, visipos, this.resolution, true, anchor)};}else{anchor.focus();}break;}}}this.getBoxOrder();}};dbxGroup.prototype.compare = function(a, b){return a[1] - b[1];};dbxGroup.prototype.createTooltip = function(isopen, anchor){if(this.keydown){this.tooltip = this.container.appendChild(dbx.createElement('span'));this.tooltip.style.visibility = 'hidden';this.tooltip.className = 'dbx-tooltip';if(isopen != null){this.tooltip.appendChild(document.createTextNode(this.vocab.kmove + this.vocab.ktoggle.replace('%toggle%', isopen ? this.vocab.close : this.vocab.open)));}else{this.tooltip.appendChild(document.createTextNode(this.vocab.kmove));}var parent = dbx.getTarget(null, 'dbx\-box', anchor);this.tooltip.style.left = parent.offsetLeft + 'px';this.tooltip.style.top = parent.offsetTop + 'px';var tooltip = this.tooltip;window.setTimeout(function(){if(tooltip != null) { tooltip.style.visibility = 'visible'; }}, 500);}};dbxGroup.prototype.removeTooltip = function(){if(this.tooltip != null){this.tooltip.parentNode.removeChild(this.tooltip);this.tooltip = null;}};dbxGroup.prototype.mousedown = function(e, box){var node = typeof e.target != 'undefined' ? e.target : e.srcElement;if(node.nodeName == '#text') { node = node.parentNode; }if(!/dbx\-(toggle|box|group)/i.test(node.className)){while(!/dbx\-(handle|box|group)/i.test(node.className)){node = node.parentNode;}}if(/dbx\-handle/i.test(node.className)){this.removeTooltip();this.released = false;this.initial = { 'x' : e.clientX, 'y' : e.clientY };this.current = { 'x' : 0, 'y' : 0 };this.createCloneBox(box);if(typeof e.preventDefault != 'undefined' ) { e.preventDefault(); }if(typeof document.onselectstart != 'undefined'){document.onselectstart = function() { return false; }}}};dbxGroup.prototype.mousemove = function(e){if(this.dragok && this.box != null){this.positive = this.vertical ? (e.clientY > this.current.y ? true : false) : (e.clientX > this.current.x ? true : false);this.current = { 'x' : e.clientX, 'y' : e.clientY };var overall = { 'x' : this.current.x - this.initial.x, 'y' : this.current.y - this.initial.y };if(((overall.x >= 0 && overall.x <= this.threshold) || (overall.x <= 0 && overall.x >= 0 - this.threshold))&&((overall.y >= 0 && overall.y <= this.threshold) || (overall.y <= 0 && overall.y >= 0 - this.threshold))){this.current.x -= overall.x;this.current.y -= overall.y;}if(this.released || overall.x > this.threshold || overall.x < (0 - this.threshold) || overall.y > this.threshold || overall.y < (0 - this.threshold)){dbx.group = this.container;dbx.box = this.box;dbx.event = e;if(typeof dbx.onboxdrag == 'undefined' || dbx.onboxdrag()){this.released = true;if(!this.restrict || !this.vertical) { this.boxclone.style.left = (this.current.x - this.difference.x) + 'px'; }if(!this.restrict || this.vertical) { this.boxclone.style.top = (this.current.y - this.difference.y) + 'px'; }this.moveOriginalToPosition(this.current.x, this.current.y);if(typeof e.preventDefault != 'undefined' ) { e.preventDefault(); }}}}return true;};dbxGroup.prototype.mouseup = function(e){if(this.box != null){this.moveOriginalToPosition(e.clientX, e.clientY);this.removeCloneBox();this.getBoxOrder();if(typeof document.onselectstart != 'undefined'){document.onselectstart = function() { return true; }}}this.dragok = false;};dbxGroup.prototype.keypress = function(e, anchor){if(/^(3[7-9])|(40)$/.test(e.keyCode)){this.removeTooltip();if((this.vertical && /^(38|40)$/.test(e.keyCode)) || (!this.vertical && /^(37|39)$/.test(e.keyCode))){this.shiftBoxPosition(e, anchor, /^[3][78]$/.test(e.keyCode) ? false : true);if(typeof e.preventDefault != 'undefined') { e.preventDefault(); }else { return false; }typeof e.stopPropagation != 'undefined' ? e.stopPropagation() : e.cancelBubble = true;this.keydown = false;}}return true;};dbxGroup.prototype.getBoxOrder = function(){this.order = [];var len = this.eles.length;for(var j=0; j<len; j++){if(/dbx\-box/i.test(this.eles[j].className) && !/dbx\-(clone|dummy)/i.test(this.eles[j].className)){this.order.push(this.eles[j].className.split('dbxid')[1] + (/dbx\-box\-open/i.test(this.eles[j].className) ? '+' : '-'));}}dbx.savedata[this.gid] = this.order.join(',');dbx.setCookieState();};dbxGroup.prototype.createClone = function(){var clone = this.container.appendChild(arguments[0].cloneNode(true));clone.className += ' dbx-clone';clone.style.position = 'absolute';clone.style.visibility = 'hidden';clone.style.zIndex = arguments[1];clone.style.left = arguments[2].x + 'px';clone.style.top = arguments[2].y + 'px';clone.style.width = arguments[0].offsetWidth + 'px';clone.style.height = arguments[0].offsetHeight + 'px';return clone;};dbxGroup.prototype.createCloneBox = function(box){this.box = box;this.position = { 'x' : this.box.offsetLeft, 'y' : this.box.offsetTop };this.difference = { 'x' : (this.initial.x - this.position.x), 'y' : (this.initial.y - this.position.y) };this.boxclone = this.createClone(this.box, 30000, this.position);this.boxclone.style.cursor = 'move';this.dragok = true;};dbxGroup.prototype.removeCloneBox = function(){this.container.removeChild(this.boxclone);this.box.style.visibility = 'visible';this.box = null;};dbxGroup.prototype.moveOriginalToPosition = function(clientX, clientY){var cloneprops = {'xy' : this.vertical ? clientY - this.difference.y : clientX - this.difference.x,'wh' : this.vertical ? this.boxclone.offsetHeight : this.boxclone.offsetWidth};this.box.style.visibility = 'hidden';this.boxclone.style.visibility = 'visible';var len = this.boxes.length;for(var i=0; i<len; i++){var boxprops = {'xy' : this.vertical ? this.boxes[i].offsetTop : this.boxes[i].offsetLeft,'wh' : this.vertical ? this.boxes[i].offsetHeight : this.boxes[i].offsetWidth};if((this.positive && cloneprops.xy + cloneprops.wh > boxprops.xy && cloneprops.xy < boxprops.xy)||(!this.positive && cloneprops.xy < boxprops.xy && cloneprops.xy + cloneprops.wh > boxprops.xy)){if(this.boxes[i] == this.box) { return; }var sibling = this.box.nextSibling;while(sibling.className == null || !/dbx\-box/.test(sibling.className)){sibling = sibling.nextSibling;}if(this.boxes[i] == sibling) { return; }if(this.resolution > 0){if(this.box[this.vertical ? 'offsetTop' : 'offsetLeft'] < boxprops.xy){var visibox = this.boxes[i].previousSibling;while(visibox.className == null || !/dbx\-box/.test(visibox.className)){visibox = visibox.previousSibling;}}else{visibox = this.boxes[i];}var visipos = { 'x' : visibox.offsetLeft, 'y' : visibox.offsetTop };}var prepos = { 'x' : this.box.offsetLeft, 'y' : this.box.offsetTop };this.container.insertBefore(this.box, this.boxes[i]);this.initial.x += (this.box.offsetLeft - prepos.x);this.initial.y += (this.box.offsetTop - prepos.y);if(this.resolution > 0 && visibox != this.box){var animator = new dbxAnimator(this, visibox, visipos, this.resolution, false, null);}else{}break;}}};function dbxAnimator(caller, box, pos, res, kbd, anchor){this.caller = caller;this.box = box;this.timer = null;var before = pos[this.caller.vertical ? 'y' : 'x'];var after = this.box[this.caller.vertical ? 'offsetTop' : 'offsetLeft'];if(before != after){if(dbx.running > this.caller.boxes.length - 1) { return; }var clone = this.caller.createClone(this.box, 29999, arguments[2]);clone.style.visibility = 'visible';this.box.style.visibility = 'hidden';this.animateClone(clone,before,after > before ? after - before : 0 - (before - after),this.caller.vertical ? 'top' : 'left',res,kbd,anchor);}};dbxAnimator.prototype.animateClone = function(clone, current, change, dir, res, kbd, anchor){var self = this;var count = 0;dbx.running ++;this.timer = window.setInterval(function(){count ++;current += change / res;clone.style[dir] = current + 'px';if(count == res){window.clearTimeout(self.timer);self.timer = null;dbx.running --;self.caller.container.removeChild(clone);self.box.style.visibility = 'visible';if(kbd){if(anchor != null && anchor.parentNode.style.visibility != 'hidden'){anchor.focus();}else if(self.caller.toggles){var button = self.caller.buttons[parseInt(self.box.className.split('dbxid')[1],10)];if(button != null && typeof button.isactive != 'undefined'){button.focus();}}}}}, 20);};if(typeof window.attachEvent != 'undefined'){window.attachEvent('onunload', function(){var ev = ['mousedown', 'mousemove', 'mouseup', 'mouseout', 'click', 'keydown', 'keyup', 'focus', 'blur', 'selectstart', 'statechange', 'boxdrag', 'boxopen', 'boxclose'];var el = ev.length;var dl = document.all.length;for(var i=0; i<dl; i++){for(var j=0; j<el; j++){document.all[i]['on' + ev[j]] = null;}}});}
\ No newline at end of file
--- a/includes/clientside/md5.js	Sun Mar 22 00:46:44 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-// Javascript implementation of the MD5 algorithm - used for encrypting password before sending them over the Internet
-var hexcase = 0; var b64pad  = ""; var chrsz   = 8;
-function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
-function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
-function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
-function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
-function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
-function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
-function md5_vm_test() { return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; }
-function core_md5(x, len) { x[len >> 5] |= 0x80 << ((len) % 32); x[(((len + 64) >>> 9) << 4) + 14] = len; var a =  1732584193; var b = -271733879; var c = -1732584194; var d =  271733878; for(var i = 0; i < x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
-         a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);c = md5_ff(c, d, a, b, x[i+10], 17, -42063);b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
-         c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
-         a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
-         c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
-         a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
-         c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
-         a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); } return Array(a, b, c, d); }
-function md5_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); }
-function md5_ff(a, b, c, d, x, s, t) { return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); }
-function md5_gg(a, b, c, d, x, s, t) { return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); }
-function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); }
-function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); }
-function core_hmac_md5(key, data) { var bkey = str2binl(key); if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); var ipad = Array(16), opad = Array(16); for(var i = 0; i < 16; i++) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5C5C5C5C; } var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); return core_md5(opad.concat(hash), 512 + 128); }
-function safe_add(x, y) {var lsw = (x & 0xFFFF) + (y & 0xFFFF);var msw = (x >> 16) + (y >> 16) + (lsw >> 16);return (msw << 16) | (lsw & 0xFFFF); }
-function bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); }
-function str2binl(str) { var bin = Array(); var mask = (1 << chrsz) - 1; for(var i = 0; i < str.length * chrsz; i += chrsz) bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); return bin; }
-function binl2str(bin) { var str = ""; var mask = (1 << chrsz) - 1; for(var i = 0; i < bin.length * 32; i += chrsz) str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); return str; }
-function binl2hex(binarray) { var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = ""; for(var i = 0; i < binarray.length * 4; i++) { str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF); } return str; }
-function binl2b64(binarray) { var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var str = ""; for(var i = 0; i < binarray.length * 4; i += 3) { var triplet = (((binarray[i >> 2] >> 8 * ( i   %4)) & 0xFF) << 16) | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) |  ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); for(var j = 0; j < 4; j++) { if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); } } return str; }
-
--- a/includes/clientside/sbedit.js	Sun Mar 22 00:46:44 2009 -0400
+++ b/includes/clientside/sbedit.js	Sun Mar 22 00:55:06 2009 -0400
@@ -1,193 +1,266 @@
-var disenable_currentBlock;
-function ajaxDisenableBlock(id)
-{
-  disenable_currentBlock = document.getElementById('disabled_'+id);
-  ajaxGet(makeUrlNS('Special', 'EditSidebar', 'action=disenable&ajax=true&noheaders&id='+id), function()
-    {
-      if ( ajax.readyState == 4 && ajax.status == 200 )
+addOnloadHook(function()
+  {
+    load_component(['jquery', 'jquery-ui']);
+    $('.sbedit-column').sortable({
+      handle: '.sbedit-handle',
+      connectWith: '.sbedit-column',
+      stop: function()
       {
-        if(ajax.responseText == 'GOOD')
-        {
-          if(disenable_currentBlock.style.display == 'none')
-          {
-            disenable_currentBlock.style.display = 'inline';
-          }
-          else
-          {
-            disenable_currentBlock.style.display = 'none';
-          }
-        } 
-        else
-        {
-          document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText;
-        }
+        ajaxUpdateSidebarOrder();
       }
     });
+  });
+
+function serialize_sidebar()
+{
+  var columns = {};
+  var i = 0;
+  $('.sbedit-column').each(function(i, e)
+    {
+      var arr = $(e).sortable('toArray');
+      for ( var j = 0; j < arr.length; j++ )
+        arr[j] = parseInt(arr[j].replace(/^block:/, ''));
+      
+      i++;
+      columns[i] = arr;
+    });
+  return toJSONString(columns);
 }
 
-var delete_currentBlock;
-function ajaxDeleteBlock(id, oElm)
+function sbedit_open_editor(a)
 {
-  delete_currentBlock = { 0 : id, 1 : oElm };
-  ajaxGet(makeUrlNS('Special', 'EditSidebar', 'action=delete&ajax=true&noheaders&id='+id), function()
-    {
-      if ( ajax.readyState == 4 && ajax.status == 200 )
+  if ( auth_level < USER_LEVEL_ADMIN )
+  {
+    load_component('login');
+    ajaxDynamicReauth(function(sid)
       {
-        if(ajax.responseText == 'GOOD')
-        {
-          e = delete_currentBlock[1];
-          e = e.parentNode.parentNode;
-          e.parentNode.removeChild(e);
-        } 
-        else
-        {
-          document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText;
-        }
-      }
-    });
+        sbedit_open_editor(a);
+      }, USER_LEVEL_ADMIN);
+    return false;
+  }
+  load_component(['fadefilter', 'l10n']);
+  var shade = darken(true, 50, 'sbedit-shade');
+  $(shade).css('z-index', 0);
+  var parent = sbedit_get_parent(a);
+  var offset = $(parent).offset();
+  var top = (( getHeight() ) / 2) - 200 + getScrollOffset();
+  var box = $(parent)
+    .clone()
+    .empty()
+    .attr('id', 'sb_blockedit')
+    .addClass('sbedit-float')
+    .css('height', $(parent).height())
+    .css('top', offset.top)
+    .css('left', offset.left)
+    .appendTo('body')
+    .animate({ width: 500, height: 400, top: top, left: (getWidth() / 2) - 250 }, 400, function()
+      {
+        var whitey = whiteOutElement(this);
+        $(this).append('<textarea style="width: 100%; height: 90%;"></textarea>');
+        $(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>');
+        $.get(makeUrlNS('Special', 'EditSidebar', 'action=getsource&noheaders&id=' + this.item_id), {}, function(response, statustext)
+          {
+            $('textarea', box).attr('value', response);
+            $(whitey).remove();
+          }, 'html');
+      })
+    .get(0);
+  box.parentdiv = parent;
+  box.item_id = parseInt($(parent).attr('id').replace(/^block:/, ''));
 }
 
-var blockEdit_current;
-function ajaxEditBlock(id, oElm)
+function sbedit_edit_save(a)
 {
-  blockEdit_current = { 0 : id, 1 : oElm };
-  ajaxGet(makeUrlNS('Special', 'EditSidebar', 'action=getsource&noheaders&id='+id), function()
+  var box = a.parentNode.parentNode;
+  var parent = box.parentdiv;
+  var whitey = whiteOutElement(box);
+  $.post(makeUrlNS('Special', 'EditSidebar', 'noheaders&action=save&id=' + box.item_id), { content: $('textarea', box).attr('value') }, function(response, statustext)
     {
-      if ( ajax.readyState == 4 && ajax.status == 200 )
-      {
-        id = blockEdit_current[0];
-        oElm = blockEdit_current[1];
-        var thediv = document.createElement('div');
-        //if(!oElm.id) oElm.id = 'autoEditButton_'+Math.floor(Math.random() * 100000);
-        oElm = oElm.parentNode;
-        var magic = $(oElm).Top() + $(oElm).Height();
-        var top = String(magic);
-        top = top + 'px';
-        left = $(oElm).Left() + 'px';
-        thediv.style.top = top;
-        thediv.style.left = left;
-        thediv.style.position = 'absolute';
-        thediv.className = 'mdg-comment';
-        thediv.style.margin = '0';
-        if(ajax.responseText == 'HOUSTON_WE_HAVE_A_PLUGIN')
+      whiteOutReportSuccess(whitey);
+      setTimeout(function()
         {
-          thediv.innerHTML = '<h3>' + $lang.get('sbedit_msg_cant_edit_plugin_title') + '</h3><p>' + $lang.get('sbedit_msg_cant_edit_plugin_body', { close_link: 'a href="#" onclick="this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode); return false;"' }) + '</p>';
-        }
-        else
-        {
-          ta = document.createElement('textarea');
-          ta.rows = '15';
-          ta.cols = '50';
-          ta.innerHTML = ajax.responseText;
-          thediv.appendChild(ta);
-          b = document.createElement('br');
-          thediv.appendChild(b);
-          thediv.innerHTML += '<a href="#" onclick="ajaxSaveBlock(this, \''+id+'\'); return false;">' + $lang.get('sbedit_btn_edit_save') + '</a>  |  <a href="#" onclick="if(confirm(\'' + $lang.get('sbedit_msg_discard_confirm') + '\')) this.parentNode.parentNode.removeChild(this.parentNode); return false;">' + $lang.get('sbedit_btn_edit_cancel') + '</a>';
-        }
-        body = document.getElementsByTagName('body');
-        body = body[0];
-        body.appendChild(thediv);
-      }
+          sbedit_close_editor(parent, box);
+        }, 1250);
+    }, 'html');
+}
+
+function sbedit_edit_cancel(a)
+{
+  var box = a.parentNode.parentNode;
+  var parent = box.parentdiv;
+  
+  sbedit_close_editor(parent, box);
+}
+
+function sbedit_close_editor(parent, box)
+{
+  var offset = $(parent).offset();
+  $(box).empty().animate(
+    {
+      width:  $(parent).width(),
+      height: $(parent).height(),
+      top:    offset.top,
+      left:   offset.left,
+    }, 400, function()
+    {
+      $(this).css('background-color', '#f70').fadeOut(1000, function() { $(this).remove(); });
+      enlighten(true, 'sbedit-shade');
     });
 }
 
-var blockSave_current;
-function ajaxSaveBlock(oElm, id)
+function sbedit_delete_block(a)
 {
-  taContent = escape(oElm.previousSibling.previousSibling.value);
-  taContent = taContent.replace(unescape('%0A'), '%0A');
-  taContent = taContent.replace('+', '%2B');
-  blockSave_current = { 0 : id, 1 : oElm };
-  ajaxPost(makeUrlNS('Special', 'EditSidebar', 'noheaders&action=save&id='+id), 'content='+taContent, function()
+  var parent = sbedit_get_parent(a);
+  load_component(['messagebox', 'fadefilter', 'flyin', 'l10n']);
+  var mp = miniPromptMessage({
+      title: $lang.get('sbedit_msg_delete_confirm_title'),
+      message: $lang.get('sbedit_msg_delete_confirm_body'),
+      buttons: [
+        {
+          text: $lang.get('sbedit_btn_delete_confirm'),
+          color: 'red',
+          onclick: function()
+          {
+            var mp = miniPromptGetParent(this);
+            sbedit_delete_block_s2(mp.target_block);
+            miniPromptDestroy(this);
+            return false;
+          },
+          style: {
+            fontWeight: 'bold'
+          }
+        },
+        {
+          text: $lang.get('etc_cancel'),
+          onclick: function()
+          {
+            miniPromptDestroy(this);
+            return false;
+          }
+        }
+      ]
+    });
+  mp.target_block = parent;
+}
+
+function sbedit_delete_block_s2(box)
+{
+  var parent = box;
+  var id = parseInt($(parent).attr('id').replace(/^block:/, ''));
+  var whitey = whiteOutElement(parent);
+  
+  $.get(makeUrlNS('Special', 'EditSidebar', 'action=delete&ajax=true&noheaders&id=' + id), function(response, statustext)
     {
-      if ( ajax.readyState == 4 && ajax.status == 200 )
+      if ( response == 'GOOD' )
       {
-        id   = blockSave_current[0];
-        oElm = blockSave_current[1];
-        eval(ajax.responseText);
-        if(status == 'GOOD')
-        {
-          var _id = 'disabled_' + String(id);
-          var parent = document.getElementById(_id).parentNode.parentNode;
-          oElm.parentNode.parentNode.removeChild(oElm.parentNode);
-          content = content.replace('%a', unescape('%0A'));
-          var obj = ( IE ) ? parent.firstChild.nextSibling.nextSibling : parent.firstChild.nextSibling.nextSibling.nextSibling;
-          if ( obj )
-            obj.innerHTML = content; // $content is set in ajax.responseText
-        }
-        else
-        {
-          alert(status);
-        }
+        whiteOutReportSuccess(whitey);
+        setTimeout(function()
+          {
+            $(parent)
+            .hide('blind', { duration: 500 }, function()
+              {
+                $(this).remove();
+                ajaxUpdateSidebarOrder();
+              });
+          }, 1250);
       }
-    });
+      else
+      {
+        whiteOutReportFailure(whitey);
+        alert(response);
+      }
+    }, 'html');
 }
 
-function ajaxRenameSidebarStage1(parent, id)
+function sbedit_rename_block(a)
 {
-  var oldname = parent.firstChild.nodeValue;
-  parent.removeChild(parent.firstChild);
-  parent.ondblclick = function() {};
-  parent._idcache = id;
-  var input = document.createElement('input');
-  input.type = 'text';
-  input.sbedit_id = id;
-  input.oldvalue = oldname;
-  input.onkeyup = function(e)
-  {
-    if ( typeof(e) != 'object' )
-      return false;
-    if ( !e.keyCode )
-      return false;
-    if ( e.keyCode == 13 )
+  var parent = sbedit_get_parent(a);
+  $('div.sbedit-handle > span', parent).hide();
+  var input = $('div.sbedit-handle > input', parent).show().focus().select().keyup(function(e)
     {
-      ajaxRenameSidebarStage2(this);
-    }
-    if ( e.keyCode == 27 )
-    {
-      ajaxRenameSidebarCancel(this);
-    }
-  };
-  input.onblur = function()
-  {
-    ajaxRenameSidebarCancel(this);
-  };
-  input.value = oldname;
-  input.style.fontSize = '7pt';
-  parent.appendChild(input);
-  input.focus();
+      switch(e.keyCode)
+      {
+        case 13:
+          // enter
+          var whitey = whiteOutElement(this.parentNode);
+          var me = this;
+          var id = parseInt($(parent).attr('id').replace(/^block:/, ''));
+          $.post(makeUrlNS('Special', 'EditSidebar', 'ajax&noheaders&action=rename&id='+id), { newname: $(this).attr('value') }, function(response, statustext)
+            {
+              if ( response == 'GOOD' )
+              {
+                whiteOutReportSuccess(whitey);
+                setTimeout(function()
+                  {
+                    $(me).hide();
+                    $('span', me.parentNode).show().text(me.value);
+                  }, 1250);
+              }
+              else
+              {
+                alert(response);
+                whiteOutReportFailure(whitey);
+              }
+            }, 'html');
+          break;
+        case 27:
+          // escape
+          this.value = this.origvalue;
+          $(this).hide();
+          $('span', this.parentNode).show();
+          break;
+      }
+    }).get(0);
+  input.origvalue = input.value;
 }
 
-function ajaxRenameSidebarStage2(input)
+function sbedit_disenable_block(a)
 {
-  var newname = input.value;
-  var id = input.sbedit_id;
-  var parent = input.parentNode;
-  parent.removeChild(input);
-  parent.appendChild(document.createTextNode(( newname == '' ? '<Unnamed>' : newname )));
-  parent.ondblclick = function() { ajaxRenameSidebarStage1(this, this._idcache); return false; };
-  var img = document.createElement('img');
-  img.src = scriptPath + '/images/loading.gif';
-  parent.appendChild(img);
-  newname = ajaxEscape(newname);
-  ajaxPost(makeUrlNS('Special', 'EditSidebar', 'ajax&noheaders&action=rename&id='+id), 'newname=' +newname, function()
+  var parent = sbedit_get_parent(a);
+  var whitey = whiteOutElement(parent);
+  $.get(makeUrlNS('Special', 'EditSidebar', 'action=disenable&ajax=true&noheaders&id=' + parseInt($(parent).attr('id').replace(/^block:/, ''))), {}, function(response, statustext)
     {
-      if ( ajax.readyState == 4 && ajax.status == 200 )
+      if ( response == 'GOOD' )
       {
-        parent.removeChild(img);
-        if ( ajax.responseText != 'GOOD' )
-          new messagebox(MB_OK|MB_ICONSTOP, 'Error renaming block', ajax.responseText);
+        whiteOutReportSuccess(whitey);
+        $(parent).toggleClass('disabled');
       }
-    });
+      else
+      {
+        whiteOutReportFailure(whitey);
+        alert(response);
+      }
+    }, 'html');
 }
 
-function ajaxRenameSidebarCancel(input)
+function sbedit_get_parent(a)
 {
-  var newname = input.oldvalue;
-  var id = input.sbedit_id;
-  var parent = input.parentNode;
-  parent.removeChild(input);
-  parent.appendChild(document.createTextNode(newname));
-  parent.ondblclick = function() { ajaxRenameSidebarStage1(this, this._idcache); return false; };
+  var o = a.parentNode;
+  while ( !$(o).hasClass('sbedit-block') )
+    o = o.parentNode;
+  
+  return o;
 }
 
+function ajaxUpdateSidebarOrder()
+{
+  setAjaxLoading();
+  var ser = serialize_sidebar();
+  $.post(makeUrlNS('Special', 'EditSidebar', 'update_order'), { order: ser }, function(response, statustext)
+    {
+      var msg = document.createElement('div');
+      $(msg)
+        .addClass('info-box-mini')
+        .text('Sidebar order saved.')
+        .css('position', 'fixed')
+        .css('bottom', 1)
+        .appendTo('body')
+        .css('left', ( getWidth() / 2 ) - ( $(msg).width() / 2 ));
+      setTimeout(function()
+        {
+          $(msg).fadeOut(500, function() { $(this).remove(); });
+        }, 1000);
+      unsetAjaxLoading();
+    }, 'json');
+}
+
--- a/language/english/admin.json	Sun Mar 22 00:46:44 2009 -0400
+++ b/language/english/admin.json	Sun Mar 22 00:55:06 2009 -0400
@@ -1090,43 +1090,66 @@
       msg_logout_complete: 'You will continue to be logged into the website, but you will need to re-authenticate before you can access the administration panel again.</p><p>Return to the <a href="%mainpage_link%">Main Page</a>.',
     },
     sbedit: {
+      header_msg: 'This control panel allows you to organize the sidebars, the collections of links and dynamic blocks that provide navigation for your site. Drag and drop blocks to move them between the left and right sidebars; changes will be saved automatically. Red blocks are disabled. This panel only works if you have Javascript enabled and working in your browser. <a href="%create_link%">Create a new block</a>.',
+      
       msg_order_update_success: 'The sidebar order information was updated successfully.',
       err_demo_php_disable: 'Adding PHP code blocks in the Enano administration demo has been disabled for security reasons.',
       msg_item_added: 'The item was added.',
       
       create_intro: 'What type of block should this be?',
-      block_type_wiki: 'Wiki-formatted block',
-      block_type_tpl: 'Template-formatted block (old pre-beta 3 behavior)',
-      block_type_html: 'Raw HTML block',
-      block_type_php: 'PHP code block (danger, Will Robinson!)',
-      block_type_plugin: 'Use code from a plugin',
+      block_type_wiki: 'Textual content (wikitext)',
+      block_type_tpl: 'List of links',
+      block_type_html: 'Pure HTML',
+      block_type_php: 'PHP code',
+      block_type_plugin: 'Plugin block',
       field_block_title: 'Block title:',
       field_block_sidebar: 'Which sidebar:',
       field_block_sidebar_left: 'Left',
       field_block_sidebar_right: 'Right',
-      field_wikitext: 'Wikitext:',
-      field_tplcode: 'Template code:',
-      field_html: 'HTML to place inside the sidebar:',
+      field_wikitext: '<p>
+                         <b>This block type is for textual content.</b> This could be information, a random fact, or some other blob of fully formatted text. Links show up inline,
+                         not as a list.
+                       </p>
+                       <p>
+                         Wikitext:
+                       </p>',
+      field_tplcode: '<p>
+                        <b>This block type is for links.</b> Use wikilinks (both internal and external are supported) to build a list of links. All links will be shown block-style,
+                        or one link per line. You can use logic in these blocks as well:
+                      </p>
+                      <pre>{if user_logged_in&#x7d;
+  [[Special:Preferences|User control panel]]
+{/if&#x7d;</pre>
+                      <p>
+                        Template code:
+                      </p>',
+      field_html: '<p>
+                     <b>This block type is for textual content.</b> HTML you use here will not be filtered or parsed at all - it will be displayed verbatim. This gives you
+                        slightly more control over your content but you can\'t use wikilinks or other wikitext in here.
+                   </p>
+                   <p>
+                     HTML to place inside the sidebar:
+                   </p>',
       field_php_disabled: 'Creating PHP blocks in demo mode is disabled for security reasons.',
       field_php: '<p>
                     <b>WARNING:</b> If you don\'t know what you\'re doing, or if you are not fluent in PHP, stop now and choose a different block type. You will brick your Enano installation if you are not careful here.
-                    ALWAYS remember to write secure code! The Enano team is not responsible if someone drops all your tables because of an SQL injection vulnerability in your sidebar code. You are probably better off using the template-formatted block type.
+                    ALWAYS remember to write secure code! The Enano team is not responsible if someone drops all your tables because of an SQL injection vulnerability in your sidebar code. You are probably better off using the links and logic block type.
                   </p>
                   <p>
                     <span style="color: red;">
-                      It is especially important to note that this code is NOT checked for errors! If there is a syntax error in your code here, it will prevent any pages from loading AT ALL. So you need to use an external PHP editor (like <a href="http://www.jedit.org">jEdit</a>) to check your syntax before you hit save.
+                      It is especially important to note that the syntax of your code is not validated here. If there is a syntax error in your code here, it might prevent Enano from working properly. It is recommended that you use an external PHP editor (like <a href="http://www.jedit.org">jEdit</a>) to check your syntax before you hit save.
                     </span> You have been warned.
                   </p>
                   <p>
                     Also, you should avoid using output buffering functions (ob_[start|end|get_contents|clean]) here, because Enano uses those to track output from this script.
                   </p>
                   <p>
-                    The standard &lt;?php and ?&gt; tags work here. Don\'t use an initial "&lt;?php" or it will cause a parse error.
+                    The standard &lt;?php and ?&gt; tags work here, but don\'t use an initial "&lt;?php" or it will cause a parse error.
                   </p>
                   <p>
                     PHP code:
                   </p>',
-      field_plugin: 'Plugin:',
+      field_plugin: '<p>Plugin:</p>',
       btn_create_block: 'Create new block',
       
       msg_block_moved: 'Item moved.',
@@ -1135,11 +1158,13 @@
       note_block_unnamed: 'Unnamed',
       hint_rename: 'Double-click to rename this block',
       note_block_disabled: '(disabled)',
-      tip_disenable: 'Enable or disable this block',
-      tip_edit: 'Edit the contents of this block',
-      tip_delete: 'Permanently delete this block',
-      tip_move: 'Move this block to the other sidebar',
-      msg_delete_confirm: 'Do you really want to delete this block?',
+      tip_disenable: 'Toggle',
+      tip_edit: 'Edit block',
+      tip_delete: 'Delete',
+      tip_rename: 'Rename',
+      msg_delete_confirm_title: 'Delete block',
+      msg_delete_confirm_body: 'Are you sure you want to delete this sidebar block?',
+      btn_delete_confirm: 'Delete block',
       btn_revert: 'Revert',
       btn_create_new_stage1: 'Create new block',
       btn_main_page: 'Main Page',
--- a/plugins/SpecialAdmin.php	Sun Mar 22 00:46:44 2009 -0400
+++ b/plugins/SpecialAdmin.php	Sun Mar 22 00:55:06 2009 -0400
@@ -2458,14 +2458,41 @@
   }
   else 
   {
+    if ( isset($_GET['update_order']) )
+    {
+      header('Content-type: text/javascript');
+      $order = @$_POST['order'];
+      try
+      {
+        $order = enano_json_decode($order);
+      }
+      catch ( Zend_Json_Exception $e )
+      {
+        return print enano_json_encode(array(
+            'mode' => 'error',
+            'error' => 'bad order'
+          ));
+      }
+      
+      foreach ( $order as $sidebar_id => $blocks )
+      {
+        foreach ( $blocks as $order => $block_id )
+        {
+          $sbid = intval($sidebar_id);
+          $order = intval($order);
+          $block_id = intval($block_id);
+          $q = $db->sql_query('UPDATE ' . table_prefix . "sidebar SET sidebar_id = $sbid, item_order = $order WHERE item_id = $block_id;");
+          if ( !$q )
+            $db->die_json();
+        }
+      }
+      
+      return print enano_json_encode(array(
+          'mode' => 'success'
+        ));
+    }
     
-    $template->add_header('<script type="text/javascript" src="'.cdnPath.'/includes/clientside/dbx.js"></script>');
-    $template->add_header('<script type="text/javascript" src="'.cdnPath.'/includes/clientside/dbx-key.js"></script>');
     $template->add_header('<script type="text/javascript" src="'.cdnPath.'/includes/clientside/sbedit.js"></script>');
-    $template->add_header('<link rel="stylesheet" type="text/css" href="'.cdnPath.'/includes/clientside/dbx.css" />');
-    
-    $template->load_theme('oxygen', 'bleu');
-    $template->init_vars();
     
     $template->header();
     
@@ -2624,27 +2651,21 @@
             </p>
             
             <div class="sbadd_block" id="blocktype_<?php echo BLOCK_WIKIFORMAT; ?>">
-              <p>
-                <?php echo $lang->get('sbedit_field_wikitext'); ?>
-              </p>
+              <?php echo $lang->get('sbedit_field_wikitext'); ?>
               <p>
                 <textarea style="width: 98%;" name="wikiformat_content" rows="15" cols="50"></textarea>
               </p>
             </div>
             
             <div class="sbadd_block" id="blocktype_<?php echo BLOCK_TEMPLATEFORMAT; ?>">
-              <p>
-                <?php echo $lang->get('sbedit_field_tplcode'); ?>
-              </p>
+              <?php echo $lang->get('sbedit_field_tplcode'); ?>
               <p>
                 <textarea style="width: 98%;" name="templateformat_content" rows="15" cols="50"></textarea>
               </p>
             </div>
             
             <div class="sbadd_block" id="blocktype_<?php echo BLOCK_HTML; ?>">
-              <p>
-                <?php echo $lang->get('sbedit_field_html'); ?>
-              </p>
+              <?php echo $lang->get('sbedit_field_html'); ?>
               <p>
                 <textarea style="width: 98%;" name="html_content" rows="15" cols="50"></textarea>
               </p>
@@ -2663,9 +2684,7 @@
             </div>
             
             <div class="sbadd_block" id="blocktype_<?php echo BLOCK_PLUGIN; ?>">
-              <p>
-                <?php echo $lang->get('sbedit_field_plugin'); ?>
-              </p>
+              <?php echo $lang->get('sbedit_field_plugin'); ?>
               <p>
                 <select name="plugin_id">
                 <?php
@@ -2814,158 +2833,117 @@
             echo 'var status=unescape(\''.hexencode($db->get_error()).'\');';
             exit;
           }
-          $q = $db->sql_query('SELECT block_type,block_content FROM '.table_prefix.'sidebar WHERE item_id=' . intval($_GET['id']) . ';');
-          if(!$q)
-          {
-            echo 'var status=unescape(\''.hexencode($db->get_error()).'\');';
-            exit;
-          }
-          $row = $db->fetchrow();
-          $db->free_result();
-          switch($row['block_type'])
-          {
-            case BLOCK_WIKIFORMAT:
-            default:
-              $c = RenderMan::render($row['block_content']);
-              break;
-            case BLOCK_TEMPLATEFORMAT:
-              $c = $template->tplWikiFormat($row['block_content'], false, 'sidebar-editor.tpl');
-              $c = preg_replace('#<a (.*?)>(.*?)</a>#is', '<a href="#" onclick="return false;">\\2</a>', $c);
-              break;
-            case BLOCK_HTML:
-              $c = $row['block_content'];
-              $c = preg_replace('#<a (.*?)>(.*?)</a>#is', '<a href="#" onclick="return false;">\\2</a>', $c);
-              break;
-            case BLOCK_PHP:
-              ob_start();
-              eval($row['block_content']);
-              $c = ob_get_contents();
-              ob_end_clean();
-              $c = preg_replace('#<a (.*?)>(.*?)</a>#is', '<a href="#" onclick="return false;">\\2</a>', $c);
-              break;
-            case BLOCK_PLUGIN:
-              $c = ($template->fetch_block($row['block_content'])) ? $template->fetch_block($row['block_content']) : $lang->get('sbedit_msg_plugin_not_loaded');
-              break;
-          }
-          $c = preg_replace('/\{(restrict|hideif) ([a-z0-9_\(\)\|&! ]+)\}/', '', $c);
-          $cache->purge('anon_sidebar');
-          die('var status = \'GOOD\'; var content = unescape(\''.hexencode($c).'\');');
+          echo 'GOOD';
+          return;
+          
           break;
       }
     }
     
-    $q = $db->sql_query('SELECT item_id,sidebar_id,item_enabled,block_name,block_type,block_content FROM '.table_prefix.'sidebar ORDER BY sidebar_id ASC, item_order ASC;');
-    if(!$q) $db->_die('The sidebar text data could not be selected.');
-    
-    $vars = $template->extract_vars('sidebar-editor.tpl');
-    
-    $parser = $template->makeParserText($vars['sidebar_button']);
-    $parser->assign_vars(Array(
-        'HREF'=>'#',
-        'FLAGS'=>'onclick="return false;"',
-        'TEXT' => $lang->get('sidebar_btn_changestyle')
-      ));
-    $template->tpl_strings['THEME_LINK'] = $parser->run();
-    $parser->assign_vars(Array(
-        'TEXT' => $lang->get('sidebar_btn_logout'),
-      ));
-    $template->tpl_strings['LOGOUT_LINK'] = $parser->run();
-    
-    $n1 = Array();
-    $n2 = Array();
-    $n  =& $n1;
+    ?>
+      <p>
+        <?php echo $lang->get('sbedit_header_msg', array( 'create_link' => makeUrlNS('Special', 'EditSidebar', 'action=new&id=0', true) )); ?>
+      </p>
+    <?php
     
-    echo '<table border="0"><tr><td valign="top"><div class="dbx-group" id="sbedit_left">';
-    //if(isset($vars['sidebar_top'])) echo $template->parse($vars['sidebar_top']);
+    $q = $db->sql_query('SELECT item_id, sidebar_id, block_name, block_type, block_content, item_enabled FROM ' . table_prefix . "sidebar ORDER BY sidebar_id ASC, item_order ASC;");
+    if ( !$q )
+      $db->_die();
     
-    // Time for the loop
-    // what this loop does is fetch the row data, then send it out to the appropriate parser for formatting,
-    // then puts the result into $c, which is then sent to the template compiler for insertion into the TPL code.
-    while($row = $db->fetchrow())
+    $switched_to_right = false;
+    
+    echo '<table border="0" cellspacing="4" cellpadding="0"><tr><td class="sbedit-column">';
+    while ( $row = $db->fetchrow() )
     {
-      if(isset($current_side))
-      {
-        if($current_side != $row['sidebar_id'])
-        {
-          // Time to switch!
-          //if(isset($vars['sidebar_top'])) echo $template->parse($vars['sidebar_bottom']);
-          echo '</div></td><td valign="top"><div class="dbx-group" id="sbedit_right">';
-          //echo '</td><td valign="top">';
-          //if(isset($vars['sidebar_top'])) echo $template->parse($vars['sidebar_top']);
-          $n =& $n2;
-        }
-      }
-      $n[] = count($n);
-      $current_side = $row['sidebar_id'];
-      switch($row['block_type'])
+      if ( $row['sidebar_id'] == SIDEBAR_RIGHT && !$switched_to_right )
       {
-        case BLOCK_WIKIFORMAT:
-        default:
-          $parser = $template->makeParserText($vars['sidebar_section']);
-          $c = RenderMan::render($row['block_content']);
-          break;
-        case BLOCK_TEMPLATEFORMAT:
-          $parser = $template->makeParserText($vars['sidebar_section']);
-          $c = $template->tplWikiFormat($row['block_content'], false, 'sidebar-editor.tpl');
-          $c = preg_replace('#<a (.*?)>(.*?)</a>#is', '<a href="#" onclick="return false;">\\2</a>', $c);
-          // fix for the "Administration" link that somehow didn't get rendered properly
-          $c = preg_replace("/(^|\n)([ ]*)<a([ ]+.*)?>(.+)<\/a>(<br(.*)\/>)([\r\n]+|$)/isU", '\\1\\2<li><a\\3>\\4</a></li>\\7', $c);
-          break;
-        case BLOCK_HTML:
-          $parser = $template->makeParserText($vars['sidebar_section_raw']);
-          $c = $row['block_content'];
-          $c = preg_replace('#<a (.*?)>(.*?)</a>#is', '<a href="#" onclick="return false;">\\2</a>', $c);
-          break;
-        case BLOCK_PHP:
-          $parser = $template->makeParserText($vars['sidebar_section_raw']);
-          ob_start();
-          eval($row['block_content']);
-          $c = ob_get_contents();
-          ob_end_clean();
-          $c = preg_replace('#<a (.*?)>(.*?)</a>#is', '<a href="#" onclick="return false;">\\2</a>', $c);
-          break;
-        case BLOCK_PLUGIN:
-          $parser = $template->makeParserText($vars['sidebar_section_raw']);
-          $c = ($template->fetch_block($row['block_content'], true)) ? $template->fetch_block($row['block_content'], true) : $lang->get('sbedit_msg_plugin_not_loaded');
-          
-          break;
+        echo '</td><td class="sbedit-column">';
+        $switched_to_right = true;
       }
-      $c = preg_replace('/\{(restrict|hideif) ([a-z0-9_\(\)\|&! ]+)\}/', '', $c);
-      $block_name = $row['block_name']; // $template->tplWikiFormat($row['block_name']);
-      if ( empty($block_name) )
-        $block_name = '&lt;' . $lang->get('sbedit_note_block_unnamed') . '&gt;';
-      $t = '<span title="' . $lang->get('sbedit_hint_rename') . '" id="sbrename_' . $row['item_id'] . '" ondblclick="ajaxRenameSidebarStage1(this, \''.$row['item_id'].'\'); return false;">' . $block_name . '</span>';
-      if($row['item_enabled'] == 0) $t .= ' <span id="disabled_'.$row['item_id'].'" style="color: red;">' . $lang->get('sbedit_note_block_disabled') . '</span>';
-      else           $t .= ' <span id="disabled_'.$row['item_id'].'" style="color: red; display: none;">' . $lang->get('sbedit_note_block_disabled') . '</span>';
-      $side = ( $row['sidebar_id'] == SIDEBAR_LEFT ) ? SIDEBAR_RIGHT : SIDEBAR_LEFT;
-      $tb = '<a title="' . $lang->get('sbedit_tip_disenable') . '" href="'.makeUrl($paths->page, 'action=disenable&id='.$row['item_id'].''       , true).'" onclick="ajaxDisenableBlock(\''.$row['item_id'].'\'); return false;"   ><img alt="' . $lang->get('sbedit_tip_disenable') . '" style="border-width: 0;" src="'.scriptPath.'/images/disenable.png" /></a>
-             <a title="' . $lang->get('sbedit_tip_edit') . '"      href="'.makeUrl($paths->page, 'action=edit&id='.$row['item_id'].''            , true).'" onclick="ajaxEditBlock(\''.$row['item_id'].'\', this); return false;"><img alt="' . $lang->get('sbedit_tip_edit') . '" style="border-width: 0;" src="'.scriptPath.'/images/edit.png" /></a>
-             <a title="' . $lang->get('sbedit_tip_delete') . '"    href="'.makeUrl($paths->page, 'action=delete&id='.$row['item_id'].''          , true).'" onclick="if(confirm(\'' . $lang->get('sbedit_msg_delete_confirm') . '\')) { ajaxDeleteBlock(\''.$row['item_id'].'\', this); } return false;"><img alt="' . $lang->get('sbedit_tip_delete') . '" style="border-width: 0;" src="'.scriptPath.'/images/delete.png" /></a>
-             <a title="' . $lang->get('sbedit_tip_move') . '"      href="'.makeUrl($paths->page, 'action=move&id='.$row['item_id'].'&side='.$side, true).'"><img alt="' . $lang->get('sbedit_tip_move') . '" style="border-width: 0;" src="'.scriptPath.'/images/move.png" /></a>';
-      $as = '';
-      $ae = '&nbsp;&nbsp;'.$tb;
-      $parser->assign_vars(Array('CONTENT'=>$c,'TITLE'=>$t,'ADMIN_START'=>$as,'ADMIN_END'=>$ae));
-      echo $parser->run();
-      unset($parser);
-      
+      $disabled_class = ( $row['item_enabled'] ) ? '' : ' disabled';
+      echo '<div class="sbedit-block' . $disabled_class . '" id="block:' . $row['item_id'] . '">
+              <div class="sbedit-handle">
+                <span>' . htmlspecialchars($template->compile_template_text_post($row['block_name'])) . '</span>
+                <input type="text" id="block_name:' . $row['item_id'] . '" value="' . htmlspecialchars($row['block_name']) . '" />
+              </div>';
+      ?>
+      <div class="sbedit-metainfo">
+        <?php
+        $toolbarvars = $template->extract_vars('toolbar.tpl');
+        $parser_start = $template->makeParserText($toolbarvars['toolbar_vert_start']);
+        echo $parser_start->run();
+        
+        $button = $template->makeParserText($toolbarvars['toolbar_vert_button']);
+        $label = $template->makeParserText($toolbarvars['toolbar_vert_label']);
+        
+        $type = '<b>';
+        switch($row['block_type'])
+        {
+          case BLOCK_WIKIFORMAT: $type .= $lang->get('sbedit_block_type_wiki'); break;
+          case BLOCK_TEMPLATEFORMAT: $type .= $lang->get('sbedit_block_type_tpl'); break;
+          case BLOCK_HTML: $type .= $lang->get('sbedit_block_type_html'); break;
+          case BLOCK_PHP: $type .= $lang->get('sbedit_block_type_php'); break;
+          case BLOCK_PLUGIN: $type .= $lang->get('sbedit_block_type_plugin'); break;
+          default: $type .= '$&#@'; break;
+        }
+        $type .= '</b>';
+        if ( $row['block_type'] == BLOCK_PLUGIN )
+        {
+          $type .= ': ' . $lang->get($row['block_content']);
+        }
+        
+        $label->assign_vars(array(
+            'TITLE' => $type
+          ));
+        echo $label->run();
+        
+        // edit
+        if ( $row['block_type'] != BLOCK_PLUGIN )
+        {
+          $button->assign_vars(array(
+              'TITLE' => $lang->get('sbedit_tip_edit'),
+              'FLAGS' => 'href="#" onclick="sbedit_open_editor(this); return false;"',
+              'IMAGE' => cdnPath . '/images/edit.png'
+            ));
+          echo $button->run();
+        }
+        
+        // delete
+        $button->assign_vars(array(
+            'TITLE' => $lang->get('sbedit_tip_delete'),
+            'FLAGS' => 'href="#" onclick="sbedit_delete_block(this); return false;"',
+            'IMAGE' => cdnPath . '/images/delete.png'
+          ));
+        echo $button->run();
+        
+        // rename
+        $button->assign_vars(array(
+            'TITLE' => $lang->get('sbedit_tip_rename'),
+            'FLAGS' => 'href="#" onclick="sbedit_rename_block(this); return false;"',
+            'IMAGE' => cdnPath . '/images/rename.png'
+          ));
+        echo $button->run();
+        
+        // disenable
+        $button->assign_vars(array(
+            'TITLE' => $lang->get('sbedit_tip_disenable'),
+            'FLAGS' => 'href="#" onclick="sbedit_disenable_block(this); return false;"',
+            'IMAGE' => cdnPath . '/images/disenable.png'
+          ));
+        echo $button->run();
+        
+        $parser_end = $template->makeParserText($toolbarvars['toolbar_vert_end']);
+        echo $parser_end->run();
+        ?>
+      </div>
+      <?php
+      echo '</div>';
     }
-    $db->free_result();
-    //if(isset($vars['sidebar_top'])) echo $template->parse($vars['sidebar_bottom']);
-    echo '</div></td></tr></table>';
-    echo '<form action="'.makeUrl($paths->page).'" method="post">';
-    $order = implode(',', $n1);
-    echo "<input type='hidden' id='divOrder_Left' name='order_left' value='{$order}' />";
-    $order = implode(',', $n2);
-    echo "<input type='hidden' id='divOrder_Right' name='order_right' value='{$order}' />";
-    echo '
-          <div style="margin: 0 auto 0 auto; text-align: center;">
-            <input type="submit" name="save" style="font-weight: bold;" value="' . $lang->get('etc_save_changes') . '" />
-            <input type="submit" name="revert" style="font-weight: normal;" value="' . $lang->get('sbedit_btn_revert') . '" onclick="return confirm($lang.get(\'sbedit_msg_discard_order_confirm\'))" />
-            <br />
-            <a href="'.makeUrl($paths->page, 'action=new&id=0', true).'">' . $lang->get('sbedit_btn_create_new_stage1') . '</a>  |  <a href="'.makeUrl(get_main_page(), false, true).'">' . $lang->get('sbedit_btn_main_page') . '</a>
-          </div>
-        </form>
-         ';
+    
+    if ( !$switched_to_right )
+      echo '</td><td class="sbedit-column">';
+    
+    echo '</td></tr></table>';
   }
   
   $template->footer();
--- a/themes/admin/sidebar-editor.tpl	Sun Mar 22 00:46:44 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-<!-- VAR sidebar_button --><li><a href="javascript:void(0)" {FLAGS}>{TEXT}</a></li>
-<!-- ENDVAR sidebar_button -->
-<!-- VAR sidebar_raw --><li><span style="text-align: center;">{HTML}</span></li>
-<!-- ENDVAR sidebar_raw -->
-<!-- VAR sidebar_top -->
-          <div class="recttop">
-            <table border="0" width="100%" cellspacing="0" cellpadding="0" style="font-size: 1px;">
-              <tr>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-menu-l.gif" width="12" height="12" /> </td>
-                <td style="margin: 0; padding: 0; height: 12px;" class="recttoptop"></td>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-menu-r.gif" width="12" height="12" /> </td>
-              </tr>
-            </table>
-          </div>
-<!-- ENDVAR sidebar_top -->
-<!-- VAR sidebar_section -->
-          <div class="dbx-box">
-            <div class="dbx-handle">
-              {ADMIN_START}
-              
-              {TITLE}
-              {ADMIN_END}
-              
-            </div>
-            <div class="dbx-content">
-              <ul>
-                {CONTENT}
-              </ul>
-            </div>
-          </div>
-<!-- ENDVAR sidebar_section -->
-<!-- VAR sidebar_section_raw -->
-          <div class="dbx-box">
-            <div class="dbx-handle">
-              {ADMIN_START}
-              
-              {TITLE}
-              {ADMIN_END}
-              
-            </div>
-            <div class="dbx-content dbx-content2">
-              <ul><li>
-                {CONTENT}
-              </li></ul>
-            </div>
-          </div>
-<!-- ENDVAR sidebar_section_raw -->
-<!-- VAR sidebar_bottom -->
-          <div class="rectbot">
-            <table border="0" width="100%" cellspacing="0" cellpadding="0" style="font-size: 1px;">
-              <tr>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-bl.gif" width="12" height="12" /> </td>
-                <td style="margin: 0; padding: 0; height: 12px;" class="rectbottop"></td>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-br.gif" width="12" height="12" /> </td>
-              </tr>
-            </table>
-          </div>
-<!-- ENDVAR sidebar_bottom -->
--- a/themes/oxygen/css/bleu.css	Sun Mar 22 00:46:44 2009 -0400
+++ b/themes/oxygen/css/bleu.css	Sun Mar 22 00:55:06 2009 -0400
@@ -797,6 +797,11 @@
   padding-right: 5px;
 }
 
+div.toolbar_vert li > span {
+  display: block;
+  padding: 4px 5px;
+}
+
 /*
  * Userpage styles
  */
--- a/themes/oxygen/sidebar-editor.tpl	Sun Mar 22 00:46:44 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-<!-- VAR sidebar_button --><li><a href="javascript:void(0)" {FLAGS}>{TEXT}</a></li>
-<!-- ENDVAR sidebar_button -->
-<!-- VAR sidebar_raw --><li><span style="text-align: center;">{HTML}</span></li>
-<!-- ENDVAR sidebar_raw -->
-<!-- VAR sidebar_top -->
-          <div class="recttop">
-            <table border="0" width="100%" cellspacing="0" cellpadding="0" style="font-size: 1px;">
-              <tr>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-menu-l.gif" width="12" height="12" /> </td>
-                <td style="margin: 0; padding: 0; height: 12px;" class="recttoptop"></td>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-menu-r.gif" width="12" height="12" /> </td>
-              </tr>
-            </table>
-          </div>
-<!-- ENDVAR sidebar_top -->
-<!-- VAR sidebar_section -->
-          <div class="dbx-box">
-            <div class="dbx-handle">
-              {ADMIN_START}
-              
-              {TITLE}
-              {ADMIN_END}
-              
-            </div>
-            <div class="dbx-content">
-              <ul>
-                {CONTENT}
-              </ul>
-            </div>
-          </div>
-<!-- ENDVAR sidebar_section -->
-<!-- VAR sidebar_section_raw -->
-          <div class="dbx-box">
-            <div class="dbx-handle">
-              {ADMIN_START}
-              
-              {TITLE}
-              {ADMIN_END}
-              
-            </div>
-            <div class="dbx-content dbx-content2">
-              {CONTENT}
-            </div>
-          </div>
-<!-- ENDVAR sidebar_section_raw -->
-<!-- VAR sidebar_bottom -->
-          <div class="rectbot">
-            <table border="0" width="100%" cellspacing="0" cellpadding="0" style="font-size: 1px;">
-              <tr>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-bl.gif" width="12" height="12" /> </td>
-                <td style="margin: 0; padding: 0; height: 12px;" class="rectbottop"></td>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-br.gif" width="12" height="12" /> </td>
-              </tr>
-            </table>
-          </div>
-<!-- ENDVAR sidebar_bottom -->
--- a/themes/printable/sidebar-editor.tpl	Sun Mar 22 00:46:44 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-<!-- VAR sidebar_button --><li><a href="javascript:void(0)" {FLAGS}>{TEXT}</a></li>
-<!-- ENDVAR sidebar_button -->
-<!-- VAR sidebar_raw --><li><span style="text-align: center;">{HTML}</span></li>
-<!-- ENDVAR sidebar_raw -->
-<!-- VAR sidebar_top -->
-          <div class="recttop">
-            <table border="0" width="100%" cellspacing="0" cellpadding="0" style="font-size: 1px;">
-              <tr>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-menu-l.gif" width="12" height="12" /> </td>
-                <td style="margin: 0; padding: 0; height: 12px;" class="recttoptop"></td>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-menu-r.gif" width="12" height="12" /> </td>
-              </tr>
-            </table>
-          </div>
-<!-- ENDVAR sidebar_top -->
-<!-- VAR sidebar_section -->
-          <div class="dbx-box">
-            <div class="dbx-handle">
-              {ADMIN_START}
-              
-              {TITLE}
-              {ADMIN_END}
-              
-            </div>
-            <div class="dbx-content">
-              <ul>
-                {CONTENT}
-              </ul>
-            </div>
-          </div>
-<!-- ENDVAR sidebar_section -->
-<!-- VAR sidebar_section_raw -->
-          <div class="dbx-box">
-            <div class="dbx-handle">
-              {ADMIN_START}
-              
-              {TITLE}
-              {ADMIN_END}
-              
-            </div>
-            <div class="dbx-content dbx-content2">
-              <ul><li>
-                {CONTENT}
-              </li></ul>
-            </div>
-          </div>
-<!-- ENDVAR sidebar_section_raw -->
-<!-- VAR sidebar_bottom -->
-          <div class="rectbot">
-            <table border="0" width="100%" cellspacing="0" cellpadding="0" style="font-size: 1px;">
-              <tr>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-bl.gif" width="12" height="12" /> </td>
-                <td style="margin: 0; padding: 0; height: 12px;" class="rectbottop"></td>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-br.gif" width="12" height="12" /> </td>
-              </tr>
-            </table>
-          </div>
-<!-- ENDVAR sidebar_bottom -->
--- a/themes/stpatty/sidebar-editor.tpl	Sun Mar 22 00:46:44 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-<!-- VAR sidebar_button --><li><a href="javascript:void(0)" {FLAGS}>{TEXT}</a></li>
-<!-- ENDVAR sidebar_button -->
-<!-- VAR sidebar_raw --><li><span style="text-align: center;">{HTML}</span></li>
-<!-- ENDVAR sidebar_raw -->
-<!-- VAR sidebar_top -->
-          <div class="recttop">
-            <table border="0" width="100%" cellspacing="0" cellpadding="0" style="font-size: 1px;">
-              <tr>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-menu-l.gif" width="12" height="12" /> </td>
-                <td style="margin: 0; padding: 0; height: 12px;" class="recttoptop"></td>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-menu-r.gif" width="12" height="12" /> </td>
-              </tr>
-            </table>
-          </div>
-<!-- ENDVAR sidebar_top -->
-<!-- VAR sidebar_section -->
-          <div class="dbx-box">
-            <div class="dbx-handle">
-              {ADMIN_START}
-              
-              {TITLE}
-              {ADMIN_END}
-              
-            </div>
-            <div class="dbx-content">
-              <ul>
-                {CONTENT}
-              </ul>
-            </div>
-          </div>
-<!-- ENDVAR sidebar_section -->
-<!-- VAR sidebar_section_raw -->
-          <div class="dbx-box">
-            <div class="dbx-handle">
-              {ADMIN_START}
-              
-              {TITLE}
-              {ADMIN_END}
-              
-            </div>
-            <div class="dbx-content dbx-content2">
-              <ul><li>
-                {CONTENT}
-              </li></ul>
-            </div>
-          </div>
-<!-- ENDVAR sidebar_section_raw -->
-<!-- VAR sidebar_bottom -->
-          <div class="rectbot">
-            <table border="0" width="100%" cellspacing="0" cellpadding="0" style="font-size: 1px;">
-              <tr>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-bl.gif" width="12" height="12" /> </td>
-                <td style="margin: 0; padding: 0; height: 12px;" class="rectbottop"></td>
-                <td style="margin: 0; padding: 0; height: 12px;"> <img alt=" " src="{SCRIPTPATH}/themes/oxygen/images/{STYLE_ID}/border-br.gif" width="12" height="12" /> </td>
-              </tr>
-            </table>
-          </div>
-<!-- ENDVAR sidebar_bottom -->