Embperl

 view release on metacpan or  search on metacpan

eg/forms/js/EmbperlForm.js  view on Meta::CPAN

            response( data )
            }
        );
    } ;

function autocomplete_setup (elem, opts)
    {
    function autocomplete_select (event, ui)
        {
        id = this.id ;
        ctlname = id.replace (/_inp_/, '') ;
        ctlid   = id.replace (/_inp_/, '_id_') ;
        
        document.getElementById(ctlname).value = ui.item.post ;
        document.getElementById(ctlid).value = ui.item.id ;
    
        if (opts.show_on_select)
            {
            i = encodeURIComponent(ui.item.id);
            if (opts.use_ajax)
                {
                $('#' + opts.use_ajax).doload (opts.showurl.replace(/%id%/g, i)) ;
                document.getElementById(ctlname).value = '' ;
                document.getElementById(ctlid).value = '' ;
                document.getElementById(id).value = '' ;
                return false ;
                }
            else
                location.href=opts.showurl.replace(/%id%/g, i); 
            }
    
        return true ;
        } ;




    elem.autocomplete(
        {
        source: autocomplete_req, 
        select: autocomplete_select,
        minLength: 3,
        delay:     400,
        url:    opts.datasrcurl,
        datasrc: opts.datasrc
        }) ;

    var id = elem[0].id ;
    var ctlid   = id.replace (/_inp_/, '_id_') ;

    elem.qtip(
        {
        content: {
            text: '<img style="text-align: center" src="/_appserv/css/images/ui-anim_basic_16x16.gif" alt="Loading..." />',
            ajax: {
               url: '#', // URL to the local file
               type: 'GET', // POST or GET
               once: false,
               xcache: false,
               idsrc: document.getElementById (ctlid),
               urlsrc: opts.popupurl,                                        
               urlfunc: function (opts)
                  {
                  i = encodeURIComponent(opts.idsrc.value);
                  if (i)
                        {                  
                        opts.url=opts.urlsrc.replace(/%id%/g, i);
                        return true ;
                        }
                  return false ;
                  }
               }
            },
        position: {
           at: 'bottom center', // Position the tooltip above the link
           my: 'top center',
           adjust: { screen: true } // Keep the tooltip on-screen at all times
        },
        show: {
           event: 'mouseenter',
           solo: true, // Only show one tooltip at a time
           delay: 1000
        },
        hide: {
           event: 'mouseleave click',
           fixed: true,
           delay: 300
        },   
        style: {
           classes: 'ui-tooltip-blue ui-tooltip-shadow',
           xwidget: true
        }
    });

    elem.dblclick (
        function (event)
            {
            i = encodeURIComponent(document.getElementById(ctlid).value);
            if (opts.use_ajax)
                {
                $('#' + opts.use_ajax).doload (opts.showurl.replace(/%id%/g, i)) ;
                }
            else
                location.href=opts.showurl.replace(/%id%/g, i); 
            }    
        ) ;
    }



// -----------------------------------------------------------------------------


function control_link_setup (elem, opts)
    {

    var id = elem[0].id ;
    var ctlid   = id.replace (/_inp_/, '') ;

    elem.qtip(
        {
        content: {
            text: '<img style="text-align: center" src="/_appserv/css/images/ui-anim_basic_16x16.gif" alt="Loading..." />',
            ajax: {
               url: '#', // URL to the local file
               type: 'GET', // POST or GET
               once: false,
               xcache: false,
               idsrc: document.getElementById (ctlid),
               urlsrc: opts.popupurl,                                        
               urlfunc: function (opts)
                  {
                  var id = opts.idsrc.value ;  
                  id = id.replace(/^.+@#/, '');
                  i = encodeURIComponent(id);
                  if (i)
                        {                  
                        opts.url=opts.urlsrc.replace(/%id%/g, i);
                        return true ;
                        }
                  return false ;
                  }
               }
            },
        position: {
           at: 'bottom center', // Position the tooltip above the link
           my: 'top center',
           adjust: { screen: true } // Keep the tooltip on-screen at all times
        },
        show: {
           event: 'mouseenter',
           solo: true, // Only show one tooltip at a time
           delay: 1000
        },
        hide: {
           event: 'mouseleave click',
           fixed: true,
           delay: 300
        },   
        style: {
           classes: 'ui-tooltip-blue ui-tooltip-shadow',
           xwidget: true
        }
    });

    elem.click (
        function (event)
            {
            var id = document.getElementById(ctlid).value ;  
            id = id.replace(/^.+@#/, '');
            i = encodeURIComponent(id);
            if (opts.use_ajax)
                {
                $('#' + opts.use_ajax).doload (opts.showurl.replace(/%id%/g, i)) ;
                }
            else
                location.href=opts.showurl.replace(/%id%/g, i); 
            }    
        ) ;
    }



// -----------------------------------------------------------------------------

function add_qtip (elem, url)
    {

    elem.qtip(
        {



( run in 0.715 second using v1.01-cache-2.11-cpan-364913b4093 )