[imp] Selecting ranges of messages

Andrew Johnson horde at lastaccess.com
Thu May 22 14:12:15 PDT 2003


Good idea. Doing it that way allows for deselection, too. I've attached a 
new patch.

--On Thursday, May 22, 2003 11:12 AM +0200 Jan Schneider <jan at horde.org> 
wrote:

> Zitat von Andrew Johnson <horde at lastaccess.com>:
>
>> I badly wanted to be able to quickly select ranges of messages in the
>> mailbox view. That is, to select a message to mark the start of a range,
>> select a message to mark the end of a range, and be able to select the
>> messages between them with one more click. A quick check did not show any
>> signs of such a feature currently... hopefully I didn't miss something.
>>
>> I added a link on the action bar (next to Delete, Undelete, Blacklist,
>> etc)
>> that allows me to do this. I can now check a start and end for the range
>> or
>> ranges, then click the Ranges link to select those between.
>>
>> This probably belongs in the Select dropdown. That's where I originally
>> had
>> it, but I found that having it on the action bar was far more convenient,
>> as this is something I use very frequently to kill rows upon rows of spam
>> messages :)
>>
>> A patch against HEAD is attached for those interested.
>
> While this is a really good idea, I'd like to see this not done by another
> link in the action bar but rather by javascript if the users uses
> Shift+Click. Any chance you can write a patch for this?
>
> Jan.
>
> --
> http://www.horde.org - The Horde Project
> http://www.ammma.de - discover your knowledge
> http://www.tip4all.de - Deine private Tippgemeinschaft
>
> --
> IMP mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: imp-unsubscribe at lists.horde.org
>



--
Andrew Johnson
horde at lastaccess.com
-------------- next part --------------
*** horde/imp/templates/mailbox/javascript.inc	Thu May 22 14:07:49 2003--- horde-dev/imp/templates/mailbox/javascript.inc	Thu May 22 14:21:42 2003****************** 7,16 ****--- 7,23 ----          if (document.messages.elements[i].checked) return true;      }      return false;  }  + function getIndexByElement(elem)+ {+     for (var i = 0; i < elem.form.elements.length; i++) {+         if (elem == elem.form.elements[i]) return i;+     }+ }+   function Submit(actID)  {  <?php if ($imp['base_protocol'] == 'pop3'): ?>      if (actID == <?php echo DELETE_MESSAGES ?>) {          if (!window.confirm('<?php echo addslashes(_("Are you sure you wish to PERMANENTLY delete these messages?")) ?>')) {****************** 53,62 ****--- 60,94 ----      } else {          document.select2.reset();      }  }  + var startrange=-1;+ + function selectRange(e)+ {+     var e = e || window.event;+     var checkBox = (e.srcElement || e.target);+     var endrange = getIndexByElement(checkBox);+ +     if (startrange>=0) {+         if (document.messages.elements[startrange].checked == document.messages.elements[endrange].checked) {+             if (startrange > endrange) {+                 var tmp = endrange;+                 endrange = startrange;+                 startrange = tmp;+             }+             for (var i = startrange+1; i<endrange; i++) {+                 document.messages.elements[i].checked = document.messages.elements[startrange].checked;+             }+         }+         startrange = -1;+     } else {+         startrange = getIndexByElement(checkBox);+     }+ }+   <?php if ($conf['user']['allow_folders']): ?>  function updateFolders(whichForm)  {      if (document.copymove2) {          if ((whichForm == 1 && document.copymove1.targetMailbox.options[document.copymove1.targetMailbox.selectedIndex].value != "") ||****************** 166,175 ****--- 198,220 ----          }      }      return '';  }  + function onClickHandler(e)+ {+     var e = e || window.event;+     var elem = (e.srcElement || e.target);+     +     // Range selection/deselection+     if (e.shiftKey && elem.name == "indices[]") {+         selectRange(e);+     }+ }+ + document.onclick = onClickHandler;+   function onKeyDownHandler(e)  {      e = e || window.event;      var o = (e.srcElement || e.target);      var next;


More information about the imp mailing list