function switch_to_room_list() {
$('iconbar').innerHTML = $('iconbar').innerHTML.substr(0, $('iconbar').innerHTML.indexOf('switch'));
+ CtdlLoadScreen('iconbar');
new Ajax.Updater('iconbar', 'iconbar_ajax_rooms', { method: 'get' } );
}
function switch_to_menu_buttons() {
which_div_expanded = null;
num_drop_targets = 0;
+ CtdlLoadScreen('iconbar');
new Ajax.Updater('iconbar', 'iconbar_ajax_menu', { method: 'get' } );
}
//
var CtdlNumMsgsSelected = 0;
var CtdlMsgsSelected = new Array();
+var CtdlLastMsgnumSelected = 0;
// This gets called when you single click on a message in the mailbox view.
// We know that the element id of the table row will be the letter 'm' plus the message number.
// Clear the preview pane until we load the new message
$('preview_pane').innerHTML = '';
- // De-select any messages that were already selected, *unless* the Ctrl key
- // is being pressed, in which case the user wants multi select.
- if (!evt.ctrlKey) {
+ // De-select any messages that were already selected, *unless* the Ctrl or
+ // Shift key is being pressed, in which case the user wants multi select
+ // or group select.
+ if ( (!evt.ctrlKey) && (!evt.shiftKey) ) {
if (CtdlNumMsgsSelected > 0) {
for (i=0; i<CtdlNumMsgsSelected; ++i) {
$('m'+CtdlMsgsSelected[i]).style.backgroundColor = '#fff';
for (i=0; i<CtdlNumMsgsSelected; ++i) {
if (CtdlMsgsSelected[i] == msgnum) {
already_selected = 1;
+ already_selected_pos = i;
}
}
}
// Now select (or de-select) the message
if ( (evt.ctrlKey) && (already_selected == 1) ) {
+
+ // Deselect: first un-highlight it...
$('m'+msgnum).style.backgroundColor = '#fff';
$('m'+msgnum).style.color = '#000';
- // FIXME pull the message out of the selected list here, stupid.
- // this will fix Bugzilla #173
+
+ // Then remove it from the selected messages list.
+ for (i=already_selected_pos; i<(CtdlNumMsgsSelected-1); ++i) {
+ CtdlMsgsSelected[i] = CtdlMsgsSelected[i+1];
+ }
+ CtdlNumMsgsSelected = CtdlNumMsgsSelected - 1;
+
+ }
+
+ else if (evt.shiftKey) {
+
+ // Group select: first clear everything out...
+ if (CtdlNumMsgsSelected > 0) {
+ for (i=0; i<CtdlNumMsgsSelected; ++i) {
+ $('m'+CtdlMsgsSelected[i]).style.backgroundColor = '#fff';
+ $('m'+CtdlMsgsSelected[i]).style.color = '#000';
+ }
+ }
+ CtdlNumMsgsSelected = 0;
+
+ // Then highlight and select the group.
+ // Traverse the table looking for a row whose ID contains the desired msgnum
+
+ var in_the_group = 0;
+ var is_edge = 0;
+ var table = $('summary_headers');
+ if (table) {
+ for (var r = 0; r < table.rows.length; r++) {
+ var thename = table.rows[r].id;
+ if ( (thename.substr(1) == msgnum) || (thename.substr(1) == CtdlLastMsgnumSelected) ) {
+ in_the_group = 1 - in_the_group;
+ is_edge = 1;
+ }
+ else {
+ is_edge = 0;
+ }
+ if ( (in_the_group == 1) || (is_edge == 1) ) {
+ // Highlight it...
+ table.rows[r].style.backgroundColor='#69aaff';
+ table.rows[r].style.color='#fff';
+
+ // And add it to the selected messages list.
+ CtdlNumMsgsSelected = CtdlNumMsgsSelected + 1;
+ CtdlMsgsSelected[CtdlNumMsgsSelected-1] = thename.substr(1);
+ }
+ }
+ }
}
+
else {
+ // Select: first highlight it...
$('m'+msgnum).style.backgroundColor='#69aaff';
$('m'+msgnum).style.color='#fff';
+
+ // Then add it to the selected messages list.
CtdlNumMsgsSelected = CtdlNumMsgsSelected + 1;
CtdlMsgsSelected[CtdlNumMsgsSelected-1] = msgnum;
- }
-
- // Update the preview pane
- new Ajax.Updater('preview_pane', 'msg/'+msgnum, { method: 'get' } );
- // Mark the message as read
- new Ajax.Request(
- 'ajax_servcmd', {
- method: 'post',
- parameters: 'g_cmd=SEEN '+msgnum+'|1',
- onComplete: CtdlRemoveTheUnseenBold(msgnum)
- }
- );
+ // Gradient
+ CtdlLoadScreen('preview_pane');
+ // Update the preview pane
+ new Ajax.Updater('preview_pane', 'msg/'+msgnum, { method: 'get' } );
+
+ // Mark the message as read
+ new Ajax.Request(
+ 'ajax_servcmd', {
+ method: 'post',
+ parameters: 'g_cmd=SEEN '+msgnum+'|1',
+ onComplete: CtdlRemoveTheUnseenBold(msgnum)
+ }
+ );
+ }
+
+ // Save the selected position in case the user does a group select next time.
+ CtdlLastMsgnumSelected = msgnum;
return false; // try to defeat the default click behavior
}
new Ajax.InPlaceEditor('note' + new_eid,
'updatenote?eid=' + new_eid , {rows:5,cols:72});
}
+
+function CtdlShowRaw(msgnum) {
+var customnav = document.createElement("span");
+var mode_citadel = document.createElement("a");
+mode_citadel.appendChild(document.createTextNode("Citadel Source"));
+var mode_rfc822 = document.createElement("a");
+mode_rfc822.appendChild(document.createTextNode(" RFC822 Source"));
+mode_citadel.setAttribute("href","#");
+mode_rfc822.setAttribute("href","#");
+mode_rfc822.setAttribute("onclick","rawSwitch822('" + msgnum + "');");
+mode_citadel.setAttribute("onclick","rawSwitchCitadel('" + msgnum + "');");
+customnav.appendChild(mode_citadel);
+customnav.appendChild(mode_rfc822);
+customnav.setAttribute("class","floatcustomnav");
+floatwindow("headerscreen","pre",customnav);
+rawSwitch822(msgnum);
+}
+function rawSwitch822(msgnum) {
+CtdlLoadScreen("headerscreen");
+new Ajax.Updater("headerscreen",
+'ajax_servcmd_esc',
+ { method: 'post',parameters: 'g_cmd=MSG2 ' +msgnum } );
+
+}
+function rawSwitchCitadel(msgnum) {
+CtdlLoadScreen("headerscreen");
+new Ajax.Updater("headerscreen",
+'ajax_servcmd_esc',
+ { method: 'post',parameters: 'g_cmd=MSG0 ' +msgnum } );
+
+}
+function floatwindow(newdivid,contentelementtype,customnav) {
+var windiv = document.createElement("div");
+windiv.setAttribute("class","floatwindow");
+var winid = newdivid+"_window";
+windiv.setAttribute("id",winid);
+var nav = document.createElement("div");
+if (customnav != null) {
+nav.appendChild(customnav);
+}
+var minimizeA = document.createElement("a");
+var minimizeButton = document.createTextNode("Close");
+minimizeA.appendChild(minimizeButton);
+minimizeA.setAttribute("onclick","killFloatWindow(this);");
+minimizeA.setAttribute("href","#");
+nav.appendChild(minimizeA);
+nav.setAttribute("class","floatnav");
+windiv.appendChild(nav);
+var contentarea = document.createElement("pre");
+contentarea.setAttribute("class","floatcontent");
+contentarea.setAttribute("id",newdivid);
+windiv.appendChild(contentarea);
+document.body.appendChild(windiv);
+}
+function killFloatWindow(caller) {
+var span = caller.parentNode;
+var fwindow = span.parentNode;
+fwindow.parentNode.removeChild(fwindow);
+}
+// Place a gradient loadscreen on an element, e.g to use before Ajax.updater
+function CtdlLoadScreen(elementid) {
+var elem = document.getElementById(elementid);
+elem.innerHTML = "<b>Loading....</b> <img src=\"/static/gradientanim.gif\"/>";
+}
+// Show info for a user, basically replaces showuser()
+// matt@comalies is to blame for this poorly coded masterpiece.
+function CtdlShowUserInfoPopup(Element) {
+try {
+// hopefully no one needs to use the class attribute... could be better done
+// with xmlns though..
+var user = Element.getAttribute("class");
+var updname = "biospace_"+user;
+if (document.getElementById(updname) == null) {
+// insert a space for the bio
+var pNode = Element.parentNode;
+var newdiv = document.createElement("div");
+newdiv.id = updname;
+newdiv.innerHTML = "Getting user info....";
+pNode.appendChild(newdiv);
+CtdlLoadScreen(updname);
+new Ajax.Updater(updname, 'showuser_ajax?who='+user, { method: 'get' } );
+}
+}
+catch(err){
+return true;
+}
+return false;
+}