/* Cblock cares about storing info and comments for given block */ /* Commentable handles all other routines such as creating list of blocks */ Commentable = function(){ /* private variables */ var cb, blocks, tpl, cn, tabs, wait, list, vlist, error, submit, postBtn; var cmResize, viewResize; var posting = false; var currentIndex, lastIndex; /* private functions */ var isOnCommentBar = function(e){ var x = cb.getX(); return(e.getPageX() >= x && e.getPageX() <= (x+30)); }; var setActiveIndex = function(index){ index = index || 0; if(typeof currentIndex != 'undefined'){ blocks[currentIndex].el.removeClass('active-content'); } currentIndex = index; blocks[currentIndex].el.addClass('active-content'); }; var onClick = function(e){ if(isOnCommentBar(e)){ var p = Ext.get(e.getTarget()); var p = Ext.get(e.getTarget()); if(p.contentIndex >= 0){ e.stopEvent(); setActiveIndex(p.contentIndex); Commentable.addComment(); } } }; var cancelSelection = function(e){ if(isOnCommentBar(e)){ e.preventDefault(); } }; var afterSuccess = function(el){ blocks[currentIndex].addComment(el); } var commentSuccess = function(o){ posting = false; var text = o.responseText; // if we got a comment block back if(text.substr(0, 3) == '