[Tickets #4316] NEW: Drag & Check on IMP Mailbox

bugs@bugs.horde.org bugs at bugs.horde.org
Sat Aug 19 09:21:25 PDT 2006


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=4316
-----------------------------------------------------------------------
 Ticket             | 4316
 Created By         | andrew at ajohnstone.com
 Summary            | Drag & Check on IMP Mailbox
 Queue              | IMP
 Version            | HEAD
 Type               | Enhancement
 State              | New
 Priority           | 1. Low
 Owners             | 
+New Attachment     | DragToCheck.txt
-----------------------------------------------------------------------


andrew at ajohnstone.com (2006-08-19 09:21) wrote:

I just implemented this on my current hord install and is very easy, and
very useful.

You can contact Peter Bailey about any licensing issues at
beetle18 at hotmail.com on msn messenger.

Append the following to the header.

<script type="text/javascript">
// <![CDATA[ Hide from XML parser

/************************************************************
        DragToCheck Class by Peter Bailey
        Copyright (c) 2003 - all rights reserved
        Do not use this script without my permission
*************************************************************/

        // Create DragToCheck objects
        function init()
        {
                var x = new DragToCheck( document.forms['A'], 1 );
                var y = new DragToCheck( document.forms['B'] );
        }

        function DragToCheck( f, sameNameOnly )
        {
                //      Abort if browser can't do script
                if (
                        ( document.all && !document.attachEvent ) ||
                        ( !document.all && !document.addEventListener )
||
                        ( typeof window.opera != 'undefined' )
                ) return;


                //      Initialize Variables/properties
                var self        = this;
                this.checked    = false;
                this.mousedown  = false;
                this.validClick = false;
                this.same       = Boolean( sameNameOnly );


                //      Attach Events
                if ( typeof f.attachEvent != 'undefined' )
                {
                        f.attachEvent( "onmousedown", function() {
downHandler( event.srcElement, self ) } );
                        f.attachEvent( "onmouseover", function() {
overHandler( event.srcElement, self ) } );
                        document.attachEvent( "onmouseup", function() {
upHandler( event.srcElement, self ) } );
                }
                else if ( typeof f.addEventListener != 'undefined' )
                {
                        f.addEventListener( "mousedown", function( e ) {
downHandler( e.target, self ) }, false );
                        f.addEventListener( "mouseover", function( e ) {
overHandler( e.target, self ) }, false );
                        document.addEventListener( "mouseup", function( e
) { upHandler( e.target, self ) }, false );
                }

                //      Handler for form.onMouseDown event
                function downHandler( elem, o )
                {
                        if ( elem.type == "checkbox" )
                        {
                                o.validClick = true;
                                o.firstCB    = elem;
                                o.mousedown  = true;
                                o.checked    = !elem.checked
                                if ( o.same )
                                        o.name   = elem.name;
                        }
                        elem.onmouseout = function()
                        {
                                if ( o.mousedown )
                                {
                                        this.checked = !this.checked;
                                }
                                this.onmouseout = null;
                        }
                }

                //      Handler for document.onMouseUp event
                function upHandler( elem, o )
                {
                        if ( o.validClick && o.firstCB )
                        {
                                o.firstCB.checked = o.checked;
                                o.mousedown       = false;
                                o.checked         = !o.checked;
                                o.validClick      = false;
                                if ( elem === o.firstCB )
                                {
                                        elem.checked = o.checked;
                                }
                        }
                }

                //      Handler for form.onMouseOver event




                //      Hanlder for form.onMouseOver event
                function overHandler( elem, o )
                {
                        if ( elem.type == "checkbox" && o.mousedown && ( (
o.same && elem.name == o.name ) || !o.same ) )
                        {
                                elem.checked = o.checked;
                        }
                }
        }

// ]]>
</script>

and the following to "mailbox/message_footers.inc"


    <script type="text/javascript">
      // <![CDATA[

      ObjName='messages';
      try {

        try {
          objPtr=document.getElementById(ObjName);
        } catch (e) {
          try {
            objPtr=document.getElementByName(ObjName);
          } catch (e) {
            alert(e.message);
          }
        }
        var x = new DragToCheck( objPtr, 1 );
      } catch(e) {
        alert(e.message)
      }

      // ]]>
      </script>





More information about the bugs mailing list